20 #ifndef JDFTX_ELECTRONIC_COLUMNBUNDLE_H 21 #define JDFTX_ELECTRONIC_COLUMNBUNDLE_H 23 #include <electronic/common.h> 24 #include <core/ManagedMemory.h> 25 #include <electronic/Basis.h> 26 #include <electronic/matrix.h> 36 int nCols()
const {
return ncols; }
38 explicit operator bool()
const {
return ncols*col_length; }
41 size_t index(
int i,
size_t j)
const {
return i*col_length+j; }
43 bool isSpinor()
const {
return basis && (col_length==2*basis->
nbasis); }
44 int spinorLength()
const {
return isSpinor() ? 2 : 1; }
70 void randomize(
int colStart,
int colStop);
74 void init(std::vector<ColumnBundle>&,
int nbundles,
int ncols=0,
const Basis* basis=0,
const ElecInfo* eInfo=0);
77 void write(
const std::vector<ColumnBundle>&,
const char *fname,
const ElecInfo& eInfo);
118 int nCols()
const {
return Mst.nCols(); }
127 void scaleAccumulate(
double alpha,
double beta,
ColumnBundle& YM)
const;
144 #endif // JDFTX_ELECTRONIC_COLUMNBUNDLE_H
Tptr operator*(const Tptr &in, double scaleFac)
Scalar multiply (preserve input)
Definition: Operators.h:116
complex dot(const Tptr &X, const Tptr &Y)
Definition: Operators.h:196
ColumnBundle similar(int ncOverride=-1) const
General complex matrix.
Definition: matrix.h:58
Template to avoid (delay) scaling operations on linear objects.
void read(const char *fname)
binary read from a file
int nCols() const
number of columns accessor
Definition: ColumnBundle.h:118
int nBandsOld
nBands for the input wavefunction
Definition: ColumnBundle.h:81
const ColumnBundle & Y
the ColumnBundle in the product
Definition: ColumnBundle.h:114
void free()
Force cleanup.
Base class for managed-memory objects (that could potentially live on GPUs as well) ...
Definition: ManagedMemory.h:26
Real diagonal matrix.
Definition: matrix.h:31
Tptr & operator-=(Tptr &in, const Tptr &other)
Decrement.
Definition: Operators.h:170
size_t colLength() const
column length accessor
Definition: ColumnBundle.h:37
Definition: ElecInfo.h:35
ColumnBundle(int nc=0, size_t len=0, const Basis *b=NULL, const QuantumNumber *q=NULL, bool onGpu=false)
onGpu MUST remain false if no GPU_ENABLED!
Real and complex scalar fields in real and reciprocal space.
double EcutOld
Ecut for the current calculation and input wavefunction in fourier space.
Definition: ColumnBundle.h:82
bool realSpace
whether to read realspace wavefunctions
Definition: ColumnBundle.h:80
int nCols() const
number of columns accessor
Definition: ColumnBundle.h:36
std::shared_ptr< complexScalarFieldTildeData > complexScalarFieldTilde
A smart reference-counting pointer to complexScalarFieldTildeData.
Definition: ScalarField.h:47
Tptr clone(const Tptr &X)
Clone (NOTE: operator= is by reference for the ScalarField classes)
Definition: Operators.h:111
vector3< int > S_old
fftbox size for the input wavefunction in double space
Definition: ColumnBundle.h:83
double scale
additional scale factor
Definition: ColumnBundle.h:116
void randomize(int colStart, int colStop)
randomize a selected range of columns
const matrixScaledTransOp & Mst
the matrix in the product (along with scale and transpose operations, if any)
Definition: ColumnBundle.h:115
ColumnBundle & operator=(const ColumnBundle &)
copy-assignment
complexScalarFieldTilde getColumn(int i, int s) const
Expand the i'th column and s'th spinor component from reduced to full G-space.
size_t index(int i, size_t j) const
Index of the i'th column j'th point into the data array.
Definition: ColumnBundle.h:41
void setSub(int colStart, const ColumnBundle &)
set columns (starting at colStart) from a ColumnBundle, ignoring columns that would go beyond nCols()...
size_t colLength() const
column length accessor
Definition: ColumnBundle.h:119
Tptr operator+(const Tptr &in1, const Tptr &in2)
Add (preserve inputs)
Definition: Operators.h:171
size_t nbasis
number of basis elements (i.e. G-vectors)
Definition: Basis.h:35
void accumColumn(int i, int s, const complexScalarFieldTilde &)
Redeuce a full G-space vector and accumulate onto the i'th column and s'th spinor component...
Tptr & operator*=(Tptr &in, double scaleFac)
Scale.
Definition: Operators.h:115
ColumnBundle getSub(int colStart, int colStop) const
get a range of columns as a ColumnBundle
Definition: ColumnBundle.h:79
Definition: ElecInfo.h:49
Matrix with a pending scale and transpose operation.
Definition: matrix.h:115
ColumnBundle with a pending matrix multiply (on the right side)
Definition: ColumnBundle.h:113
void write(const char *fname) const
binary-write to a file
Complex number (need to define our own because we need operators for gpu code as well) ...
Definition: scalar.h:49
void setColumn(int i, int s, const complexScalarFieldTilde &)
Redeuce a full G-space vector and store it as the i'th column and s'th spinor component.
Definition: ColumnBundle.h:30
Tptr & operator+=(Tptr &in, const Tptr &other)
Increment.
Definition: Operators.h:169
void init(int nc, size_t len, const Basis *b, const QuantumNumber *q, bool onGpu=false)
onGpu MUST remain false if no GPU_ENABLED!
Tptr operator-(const Tptr &in1, const Tptr &in2)
Subtract (preserve inputs)
Definition: Operators.h:175