PEXSI
 All Classes Namespaces Files Functions Variables Typedefs Pages
Classes | Typedefs | Enumerations | Functions | Variables
PEXSI Namespace Reference

The main namespace. More...

Classes

struct  NullStream
 
class  ExceptionTracer
 
class  PMatrix
 PMatrix contains the main data structure and the computational routine for the parallel selected inversion. More...
 
class  NumMat
 Numerical matrix. More...
 
class  NumTns
 Numerical tensor. More...
 
class  NumVec
 Numerical vector. More...
 
struct  ULComparator
 
struct  PSelInvOptions
 A thin interface for passing parameters to set the PSelInv options. More...
 
struct  GridType
 GridType is the PSelInv way of defining the grid. More...
 
struct  SuperNodeType
 SuperNodeType describes mapping between supernode and column, the permutation information, and potentially the elimination tree (not implemented here). More...
 
struct  LBlock
 LBlock stores a nonzero block in the lower triangular part or the diagonal part in PSelInv. More...
 
struct  UBlock
 UBlock stores a nonzero block in the upper triangular part in PSelInv. More...
 
class  PMatrixUnsym
 PMatrixUnsym contains the main data structure and the computational routine for the parallel selected inversion. More...
 
struct  CDBuffers
 
struct  SparseMatrix
 SparseMatrix describes a sequential sparse matrix saved in compressed sparse column format. More...
 
struct  DistSparseMatrix
 DistSparseMatrix describes a Sparse matrix in the compressed sparse column format (CSC) and distributed with column major partition. More...
 
struct  IndexComparator
 
struct  SuperLUOptions
 A thin interface for passing parameters to set the SuperLU options. More...
 
class  RealSuperLUData
 
class  ComplexSuperLUData
 
class  ComplexGridData
 
class  RealGridData
 
class  SuperLUGrid
 A thin interface for the gridinfo_t structure in SuperLU. More...
 
class  SuperLUGrid< Real >
 
class  SuperLUGrid< Complex >
 
class  SuperLUMatrix
 An thin interface to keep the main code insulated from the source code of SuperLU. More...
 
class  SuperLUMatrix< Real >
 
class  SuperLUMatrix< Complex >
 
class  Vec3T
 Tiny vectors of dimension 3. More...
 
class  TreeBcast
 
class  FTreeBcast
 
class  BTreeBcast
 
class  ModBTreeBcast
 
class  RandBTreeBcast
 
class  PalmTreeBcast
 
class  TreeReduce
 
class  FTreeReduce
 
class  BTreeReduce
 
class  ModBTreeReduce
 
class  PalmTreeReduce
 
struct  IndexComp
 
class  PPEXSIData
 Main class for parallel PEXSI. More...
 
class  ComplexGridInfo
 
class  ComplexSuperLUData_internal
 
class  RealGridInfo
 
class  RealSuperLUData_internal
 

Typedefs

typedef int Int
 
typedef int64_t LongInt
 
typedef double Real
 
typedef std::complex< double > Complex
 
typedef std::complex< double > Scalar
 
typedef NumMat< bool > BolNumMat
 
typedef NumMat< Int > IntNumMat
 
typedef NumMat< Real > DblNumMat
 
typedef NumMat< Complex > CpxNumMat
 
typedef NumTns< bool > BolNumTns
 
typedef NumTns< Int > IntNumTns
 
typedef NumTns< Real > DblNumTns
 
typedef NumTns< Complex > CpxNumTns
 
typedef NumVec< bool > BolNumVec
 
typedef NumVec< Int > IntNumVec
 
typedef NumVec< Real > DblNumVec
 
typedef NumVec< Complex > CpxNumVec
 
typedef std::vector< bool > bitMask
 
typedef std::map< bitMask,
std::vector< Int > > 
bitMaskSet
 
typedef SparseMatrix< Real > DblSparseMatrix
 
typedef SparseMatrix< Complex > CpxSparseMatrix
 
typedef DistSparseMatrix< Real > DblDistSparseMatrix
 
typedef DistSparseMatrix< Complex > CpxDistSparseMatrix
 
typedef Vec3T< Real > Point3
 
typedef Vec3T< Int > Index3
 

Enumerations

enum  MSGTYPE {
  LSIZE =0, LROWSIZE, USIZE, UCOLSIZE,
  LCONTENT, LROWCONTENT, UCONTENT, UCOLCONTENT,
  MSGCOUNT
}
 

Functions

template<typename T >
const T ZERO ()
 
template<typename T >
const T ONE ()
 
template<typename T >
const T MINUS_ONE ()
 
void gdb_lock ()
 
void PushCallStack (std::string s)
 
void PopCallStack ()
 
void DumpCallStack ()
 
Int iround (Real a)
 
void OptionsCreate (Int argc, char **argv, std::map< std::string, std::string > &options)
 
Int Size (std::stringstream &sstm)
 
template<typename T >
void NGCHOLMatrixToSuperNode (LIBCHOLESKY::SupernodalMatrix< T > &SMat, SuperNodeType &super)
 Converts the NGCHOL supernodal structure to PMatrix SuperNodeType structure.
 
template<typename T >
void NGCHOLMatrixToPMatrix (LIBCHOLESKY::SupernodalMatrix< T > &SMat, PMatrix< T > &PMat)
 Converts a matrix of NGCHOL type to PMatrix.
 
template<typename T >
void PMatrixLtoU (PMatrix< T > &PMat)
 
template<class F >
void SetValue (NumMat< F > &M, F val)
 SetValue sets a numerical matrix to a constant val.
 
template<class F >
Real Energy (const NumMat< F > &M)
 Energy computes the L2 norm of a matrix (treated as a vector).
 
template<class F >
void Transpose (const NumMat< F > &A, NumMat< F > &B)
 
template<class F >
void Symmetrize (NumMat< F > &A)
 
template<class F >
void SetValue (NumTns< F > &T, F val)
 SetValue sets a numerical tensor to a constant val.
 
template<class F >
Real Energy (const NumTns< F > &T)
 Energy computes the L2 norm of a tensor (treated as a vector).
 
template<class F >
void SetValue (NumVec< F > &vec, F val)
 SetValue sets a numerical vector to a constant val.
 
template<class F >
Real Energy (const NumVec< F > &vec)
 Energy computes the L2 norm of a vector.
 
int GetPoleDensity (Complex *zshift, Complex *zweight, int Npole, double temp, double gap, double deltaE, double mu)
 Pole expansion for the Fermi-Dirac operator. More...
 
int GetPoleDensityDrvMu (Complex *zshift, Complex *zweight, int Npole, double temp, double gap, double deltaE, double mu)
 Pole expansion for the derivative of the Fermi-Dirac operator with respect to the chemical potential mu. More...
 
int GetPoleDensityDrvT (Complex *zshift, Complex *zweight, int Npole, double temp, double gap, double deltaE, double mu)
 Pole expansion for the derivative of the Fermi-Dirac operator with respect to the temperature T \((1/\beta)\). More...
 
int GetPoleHelmholtz (Complex *zshift, Complex *zweight, int Npole, double temp, double gap, double deltaE, double mu)
 Pole expansion for the Helmholtz free energy function. More...
 
int GetPoleForce (Complex *zshift, Complex *zweight, int Npole, double temp, double gap, double deltaE, double mu)
 Pole expansion for the energy density function. More...
 
int GetPoleDensityUpdate (Complex *zshift, Complex *zweight, int Npole, double temp, double gap, double deltaE, double mu, double dmu)
 Pole expansion for the Fermi-Dirac operator and update the weight at mu+dmu. More...
 
int GetPoleHelmholtzUpdate (Complex *zshift, Complex *zweight, int Npole, double temp, double gap, double deltaE, double mu, double dmu)
 Pole expansion for the Helmholtz free energy function. More...
 
int GetPoleForceUpdate (Complex *zshift, Complex *zweight, int Npole, double temp, double gap, double deltaE, double mu, double dmu)
 Pole expansion for the energy density function. More...
 
Int MYPROC (const GridType *g)
 MYPROC returns the current processor rank.
 
Int MYROW (const GridType *g)
 MYROW returns my processor row.
 
Int MYCOL (const GridType *g)
 MYCOL returns my processor column.
 
Int PROW (Int bnum, const GridType *g)
 PROW returns the processor row that the bnum-th block (supernode) belongs to.
 
Int PCOL (Int bnum, const GridType *g)
 PCOL returns the processor column that the bnum-th block (supernode) belongs to.
 
Int PNUM (Int i, Int j, const GridType *g)
 PNUM returns the processor rank that the bnum-th block (supernode) belongs to.
 
Int LBi (Int bnum, const GridType *g)
 LBi returns the local block number on the processor at processor row PROW( bnum, g ).
 
Int LBj (Int bnum, const GridType *g)
 LBj returns the local block number on the processor at processor column PCOL( bnum, g ).
 
Int GBi (Int iLocal, const GridType *g)
 GBi returns the global block number from a local block number in the row direction.
 
Int GBj (Int jLocal, const GridType *g)
 GBj returns the global block number from a local block number in the column direction.
 
Int CEILING (Int a, Int b)
 CEILING is used for computing the storage space for local number of blocks.
 
Int BlockIdx (Int i, const SuperNodeType *s)
 BlockIdx returns the block index of a column i.
 
Int FirstBlockCol (Int bnum, const SuperNodeType *s)
 FirstBlockCol returns the first column of a block bnum.
 
Int FirstBlockRow (Int bnum, const SuperNodeType *s)
 FirstBlockRow returns the first column of a block bnum. Note: the functionality of FirstBlockRow is exactly the same as in FirstBlockCol.
 
Int SuperSize (Int bnum, const SuperNodeType *s)
 SuperSize returns the size of the block bnum.
 
Int NumSuper (const SuperNodeType *s)
 NumSuper returns the total number of supernodes.
 
Int NumCol (const SuperNodeType *s)
 NumCol returns the total number of columns for a supernodal partiiton.
 
template<typename T >
Int serialize (LBlock< T > &val, std::ostream &os, const std::vector< Int > &mask)
 
template<typename T >
Int deserialize (LBlock< T > &val, std::istream &is, const std::vector< Int > &mask)
 
template<typename T >
Int serialize (UBlock< T > &val, std::ostream &os, const std::vector< Int > &mask)
 
template<typename T >
Int deserialize (UBlock< T > &val, std::istream &is, const std::vector< Int > &mask)
 
template<typename T >
bool LBlockEqualComparator (const LBlock< T > &a, const LBlock< T > &b)
 
template<typename T >
bool LBlockComparator (const LBlock< T > &a, const LBlock< T > &b)
 
template<typename T >
bool UBlockComparator (const UBlock< T > &a, const UBlock< T > &b)
 
template<class F >
bool operator== (const Vec3T< F > &a, const Vec3T< F > &b)
 
template<class F >
bool operator!= (const Vec3T< F > &a, const Vec3T< F > &b)
 
template<class F >
bool operator> (const Vec3T< F > &a, const Vec3T< F > &b)
 
template<class F >
bool operator< (const Vec3T< F > &a, const Vec3T< F > &b)
 
template<class F >
bool operator>= (const Vec3T< F > &a, const Vec3T< F > &b)
 
template<class F >
bool operator<= (const Vec3T< F > &a, const Vec3T< F > &b)
 
template<class F >
Vec3T< F > operator- (const Vec3T< F > &a)
 
template<class F >
Vec3T< F > operator+ (const Vec3T< F > &a, const Vec3T< F > &b)
 
template<class F >
Vec3T< F > operator- (const Vec3T< F > &a, const Vec3T< F > &b)
 
template<class F >
Vec3T< F > operator* (F scl, const Vec3T< F > &a)
 
template<class F >
Vec3T< F > operator* (const Vec3T< F > &a, F scl)
 
template<class F >
Vec3T< F > operator/ (const Vec3T< F > &a, F scl)
 
template<class F >
operator* (const Vec3T< F > &a, const Vec3T< F > &b)
 
template<class F >
dot (const Vec3T< F > &a, const Vec3T< F > &b)
 
template<class F >
Vec3T< F > operator^ (const Vec3T< F > &a, const Vec3T< F > &b)
 
template<class F >
Vec3T< F > cross (const Vec3T< F > &a, const Vec3T< F > &b)
 
template<class F >
Vec3T< F > ewmin (const Vec3T< F > &a, const Vec3T< F > &b)
 
template<class F >
Vec3T< F > ewmax (const Vec3T< F > &a, const Vec3T< F > &b)
 
template<class F >
Vec3T< F > ewabs (const Vec3T< F > &a)
 
template<class F >
Vec3T< F > ewmul (const Vec3T< F > &a, const Vec3T< F > &b)
 
template<class F >
Vec3T< F > ewdiv (const Vec3T< F > &a, const Vec3T< F > &b)
 
template<class F >
Vec3T< F > ewrnd (const Vec3T< F > &a)
 
template<class F >
bool allequ (const Vec3T< F > &a, const Vec3T< F > &b)
 
template<class F >
bool allneq (const Vec3T< F > &a, const Vec3T< F > &b)
 
template<class F >
bool allgtt (const Vec3T< F > &a, const Vec3T< F > &b)
 
template<class F >
bool alllst (const Vec3T< F > &a, const Vec3T< F > &b)
 
template<class F >
bool allgoe (const Vec3T< F > &a, const Vec3T< F > &b)
 
template<class F >
bool allloe (const Vec3T< F > &a, const Vec3T< F > &b)
 
template<class F >
std::istream & operator>> (std::istream &is, Vec3T< F > &a)
 
template<class F >
std::ostream & operator<< (std::ostream &os, const Vec3T< F > &a)
 
const std::vector< Int > NO_MASK (1)
 
Int PrintBlock (std::ostream &os, const std::string name)
 
Int Print (std::ostream &os, const std::string name)
 
Int Print (std::ostream &os, const char *name)
 
Int Print (std::ostream &os, const std::string name, std::string val)
 
Int Print (std::ostream &os, const std::string name, const char *val)
 
Int Print (std::ostream &os, const std::string name, Real val)
 
Int Print (std::ostream &os, const char *name, Real val)
 
Int Print (std::ostream &os, const std::string name, Real val, const std::string unit)
 
Int Print (std::ostream &os, const char *name, Real val, const char *unit)
 
Int Print (std::ostream &os, const std::string name1, Real val1, const std::string unit1, const std::string name2, Real val2, const std::string unit2)
 
Int Print (std::ostream &os, const char *name1, Real val1, const char *unit1, char *name2, Real val2, char *unit2)
 
Int Print (std::ostream &os, const std::string name1, Int val1, const std::string unit1, const std::string name2, Real val2, const std::string unit2)
 
Int Print (std::ostream &os, const char *name1, Int val1, const char *unit1, char *name2, Real val2, char *unit2)
 
Int Print (std::ostream &os, const char *name1, Int val1, const char *name2, Real val2, char *name3, Real val3)
 
Int Print (std::ostream &os, const char *name1, Int val1, const char *name2, Real val2, const char *name3, Real val3, const char *name4, Real val4)
 
Int Print (std::ostream &os, std::string name, Int val)
 
Int Print (std::ostream &os, const char *name, Int val)
 
Int Print (std::ostream &os, const std::string name, Int val, const std::string unit)
 
Int Print (std::ostream &os, const char *name, Int val, const std::string unit)
 
Int Print (std::ostream &os, const std::string name1, Int val1, const std::string unit1, const std::string name2, Int val2, const std::string unit2)
 
Int Print (std::ostream &os, const char *name1, Int val1, const char *unit1, char *name2, Int val2, char *unit2)
 
Int Print (std::ostream &os, const std::string name, bool val)
 
Int Print (std::ostream &os, const char *name, bool val)
 
Int Print (std::ostream &os, const char *name1, Index3 val)
 
Int Print (std::ostream &os, const char *name1, Point3 val)
 
Int Print (std::ostream &os, const char *name1, Int val1, const char *name2, Point3 val)
 
template<class F >
std::ostream & operator<< (std::ostream &os, const std::vector< F > &vec)
 
template<class F >
std::ostream & operator<< (std::ostream &os, const NumVec< F > &vec)
 
template<class F >
std::ostream & operator<< (std::ostream &os, const NumMat< F > &mat)
 
template<class F >
std::ostream & operator<< (std::ostream &os, const NumTns< F > &tns)
 
template<typename T >
Int serialize (const T &val, std::ostream &os, const std::vector< Int > &mask)
 
template<typename T >
Int deserialize (T &val, std::istream &is, const std::vector< Int > &mask)
 
Int serialize (const bool &val, std::ostream &os, const std::vector< Int > &mask)
 
Int deserialize (bool &val, std::istream &is, const std::vector< Int > &mask)
 
Int serialize (const char &val, std::ostream &os, const std::vector< Int > &mask)
 
Int deserialize (char &val, std::istream &is, const std::vector< Int > &mask)
 
Int combine (char &val, char &ext)
 
Int serialize (const Int &val, std::ostream &os, const std::vector< Int > &mask)
 
Int deserialize (Int &val, std::istream &is, const std::vector< Int > &mask)
 
Int combine (Int &val, Int &ext)
 
Int serialize (const LongInt &val, std::ostream &os, const std::vector< Int > &mask)
 
Int deserialize (LongInt &val, std::istream &is, const std::vector< Int > &mask)
 
Int combine (LongInt &val, LongInt &ext)
 
Int serialize (const Real &val, std::ostream &os, const std::vector< Int > &mask)
 
Int deserialize (Real &val, std::istream &is, const std::vector< Int > &mask)
 
Int combine (Real &val, Real &ext)
 
Int serialize (const Complex &val, std::ostream &os, const std::vector< Int > &mask)
 
Int deserialize (Complex &val, std::istream &is, const std::vector< Int > &mask)
 
Int combine (Complex &val, Complex &ext)
 
Int serialize (const Index3 &val, std::ostream &os, const std::vector< Int > &mask)
 
Int deserialize (Index3 &val, std::istream &is, const std::vector< Int > &mask)
 
Int combine (Index3 &val, Index3 &ext)
 
Int serialize (const Point3 &val, std::ostream &os, const std::vector< Int > &mask)
 
Int deserialize (Point3 &val, std::istream &is, const std::vector< Int > &mask)
 
Int combine (Point3 &val, Point3 &ext)
 
template<class T >
Int serialize (const std::vector< T > &val, std::ostream &os, const std::vector< Int > &mask)
 
template<class T >
Int deserialize (std::vector< T > &val, std::istream &is, const std::vector< Int > &mask)
 
template<class T >
Int combine (std::vector< T > &val, std::vector< T > &ext)
 
template<class T >
Int serialize (const std::set< T > &val, std::ostream &os, const std::vector< Int > &mask)
 
template<class T >
Int deserialize (std::set< T > &val, std::istream &is, const std::vector< Int > &mask)
 
template<class T >
Int combine (std::set< T > &val, std::set< T > &ext)
 
template<class T , class S >
Int serialize (const std::map< T, S > &val, std::ostream &os, const std::vector< Int > &mask)
 
template<class T , class S >
Int deserialize (std::map< T, S > &val, std::istream &is, const std::vector< Int > &mask)
 
template<class T , class S >
Int combine (std::map< T, S > &val, std::map< T, S > &ext)
 
template<class T , class S >
Int serialize (const std::pair< T, S > &val, std::ostream &os, const std::vector< Int > &mask)
 
template<class T , class S >
Int deserialize (std::pair< T, S > &val, std::istream &is, const std::vector< Int > &mask)
 
template<class T , class S >
Int combine (std::pair< T, S > &val, std::pair< T, S > &ext)
 
Int serialize (const IntNumVec &val, std::ostream &os, const std::vector< Int > &mask)
 
Int deserialize (IntNumVec &val, std::istream &is, const std::vector< Int > &mask)
 
Int combine (IntNumVec &val, IntNumVec &ext)
 
Int serialize (const IntNumMat &val, std::ostream &os, const std::vector< Int > &mask)
 
Int deserialize (IntNumMat &val, std::istream &is, const std::vector< Int > &mask)
 
Int combine (IntNumMat &val, IntNumMat &ext)
 
Int serialize (const IntNumTns &val, std::ostream &os, const std::vector< Int > &mask)
 
Int deserialize (IntNumTns &val, std::istream &is, const std::vector< Int > &mask)
 
Int combine (IntNumTns &val, IntNumTns &ext)
 
Int serialize (const DblNumVec &val, std::ostream &os, const std::vector< Int > &mask)
 
Int deserialize (DblNumVec &val, std::istream &is, const std::vector< Int > &mask)
 
Int combine (DblNumVec &val, DblNumVec &ext)
 
Int serialize (const DblNumMat &val, std::ostream &os, const std::vector< Int > &mask)
 
Int deserialize (DblNumMat &val, std::istream &is, const std::vector< Int > &mask)
 
Int combine (DblNumMat &val, DblNumMat &ext)
 
Int serialize (const DblNumTns &val, std::ostream &os, const std::vector< Int > &mask)
 
Int deserialize (DblNumTns &val, std::istream &is, const std::vector< Int > &mask)
 
Int combine (DblNumTns &val, DblNumTns &ext)
 
Int serialize (const CpxNumVec &val, std::ostream &os, const std::vector< Int > &mask)
 
Int deserialize (CpxNumVec &val, std::istream &is, const std::vector< Int > &mask)
 
Int combine (CpxNumVec &val, CpxNumVec &ext)
 
Int serialize (const CpxNumMat &val, std::ostream &os, const std::vector< Int > &mask)
 
Int deserialize (CpxNumMat &val, std::istream &is, const std::vector< Int > &mask)
 
Int combine (CpxNumMat &val, CpxNumMat &ext)
 
Int serialize (const CpxNumTns &val, std::ostream &os, const std::vector< Int > &mask)
 
Int deserialize (CpxNumTns &val, std::istream &is, const std::vector< Int > &mask)
 
Int combine (CpxNumTns &val, CpxNumTns &ext)
 
template<class T >
Int serialize (const NumVec< T > &val, std::ostream &os, const std::vector< Int > &mask)
 
template<class T >
Int deserialize (NumVec< T > &val, std::istream &is, const std::vector< Int > &mask)
 
template<class T >
Int combine (NumVec< T > &val, NumVec< T > &ext)
 
template<class T >
Int serialize (const NumMat< T > &val, std::ostream &os, const std::vector< Int > &mask)
 
template<class T >
Int deserialize (NumMat< T > &val, std::istream &is, const std::vector< Int > &mask)
 
template<class T >
Int combine (NumMat< T > &val, NumMat< T > &ext)
 
template<class T >
Int serialize (const NumTns< T > &val, std::ostream &os, const std::vector< Int > &mask)
 
template<class T >
Int deserialize (NumTns< T > &val, std::istream &is, const std::vector< Int > &mask)
 
template<class T >
Int combine (NumTns< T > &val, NumTns< T > &ext)
 
template<class T >
Int serialize (const DistSparseMatrix< T > &val, std::ostream &os, const std::vector< Int > &mask)
 
template<class T >
Int deserialize (DistSparseMatrix< T > &val, std::istream &is, const std::vector< Int > &mask)
 
template<class T >
Int combine (DistSparseMatrix< T > &val, DistSparseMatrix< T > &ext)
 
Int SeparateRead (std::string name, std::istringstream &is)
 
Int SeparateWrite (std::string name, std::ostringstream &os)
 
Int SeparateWriteAscii (std::string name, std::ostringstream &os)
 
Int SharedRead (std::string name, std::istringstream &is)
 
Int SharedWrite (std::string name, std::ostringstream &os)
 
void IdentityCol (Int col, NumVec< Real > &vec)
 
void IdentityCol (Int col, NumVec< Complex > &vec)
 
void IdentityCol (IntNumVec &cols, NumMat< Real > &mat)
 
void IdentityCol (IntNumVec &cols, NumMat< Complex > &mat)
 
void SetRandomSeed (long int seed)
 
Real UniformRandom ()
 
void UniformRandom (NumVec< Real > &vec)
 
void UniformRandom (NumVec< Complex > &vec)
 
void UniformRandom (NumMat< Real > &M)
 
void UniformRandom (NumMat< Complex > &M)
 
void UniformRandom (NumTns< Real > &T)
 
void UniformRandom (NumTns< Complex > &T)
 
void GetTime (Real &t)
 
bool PairLtComparator (const std::pair< Real, Int > &l, const std::pair< Real, Int > &r)
 
bool PairGtComparator (const std::pair< Real, Int > &l, const std::pair< Real, Int > &r)
 
template<typename T >
void CSCToCSR (DistSparseMatrix< T > &sparseA, DistSparseMatrix< T > &sparseB)
 
void ReadSparseMatrix (const char *filename, SparseMatrix< Real > &spmat)
 
void ReadDistSparseMatrix (const char *filename, DistSparseMatrix< Real > &pspmat, MPI_Comm comm)
 
void ParaReadDistSparseMatrix (const char *filename, DistSparseMatrix< Real > &pspmat, MPI_Comm comm)
 
void ParaWriteDistSparseMatrix (const char *filename, DistSparseMatrix< Real > &pspmat, MPI_Comm comm)
 
void ReadDistSparseMatrixFormatted (const char *filename, DistSparseMatrix< Real > &pspmat, MPI_Comm comm)
 
void ParaReadDistSparseMatrix (const char *filename, DistSparseMatrix< Complex > &pspmat, MPI_Comm comm)
 
void ParaWriteDistSparseMatrix (const char *filename, DistSparseMatrix< Complex > &pspmat, MPI_Comm comm)
 
void ReadDistSparseMatrixFormatted (const char *filename, DistSparseMatrix< Complex > &pspmat, MPI_Comm comm)
 
template<class F1 , class F2 >
void CopyPattern (const SparseMatrix< F1 > &A, SparseMatrix< F2 > &B)
 
template<typename T >
void GetDiagonal (const DistSparseMatrix< T > &A, NumVec< T > &diag)
 
template<class F1 , class F2 >
void CopyPattern (const DistSparseMatrix< F1 > &A, DistSparseMatrix< F2 > &B)
 
template<class F >
void DistSparseMatMultGlobalVec (const F alpha, const DistSparseMatrix< F > &AMat, const NumVec< F > &B, const F beta, NumVec< F > &C)
 Multiply a DistSparseMatrix with a vector that is distributed across all processors participating the operation. More...
 
void LinearInterpolation (const std::vector< Real > &x, const std::vector< Real > &y, const std::vector< Real > &xx, std::vector< Real > &yy)
 Linear interpolates from (x,y) to (xx,yy) More...
 
Real MonotoneRootFinding (const std::vector< Real > &x, const std::vector< Real > &y, Real val)
 Root finding for monotonic non-decreasing functions. More...
 
Complex fd (Complex z, double beta, double mu)
 
Complex fdDrvMu (Complex z, double beta, double mu)
 
Complex fdDrvT (Complex z, double beta, double mu)
 
Complex egy (Complex z, double beta, double mu)
 
Complex hmz (Complex z, double beta, double mu)
 
void ellipkkp (double *K, double *Kp, double *pL)
 
void ellipjc (Complex *psn, Complex *pcn, Complex *pdn, Complex *pu, double *pL, int *flag)
 
int GetPoleFunc (Complex(*func)(Complex, double, double), Complex *zshift, Complex *zweight, int *Npole, double *temp, double *gap, double *deltaE, double *mu)
 Compute the pole expansion. More...
 
int GetPoleUpdateFunc (Complex(*func)(Complex, double, double), Complex *zshift, Complex *zweight, int *Npole, double *temp, double *gap, double *deltaE, double *mu, double *dmu)
 Compute the update of the pole expansion. More...
 
 abort ()
 

Variables

std::ofstream statusOFS
 
const Int I_ZERO = 0
 
const Int I_ONE = 1
 
const Int I_MINUS_ONE = -1
 
const Real D_ZERO = 0.0
 
const Real D_ONE = 1.0
 
const Real D_MINUS_ONE = -1.0
 
const Complex Z_ZERO = Complex(0.0, 0.0)
 
const Complex Z_ONE = Complex(1.0, 0.0)
 
const Complex Z_MINUS_ONE = Complex(-1.0, 0.0)
 
const Complex Z_I = Complex(0.0, 1.0)
 
const Complex Z_MINUS_I = Complex(0.0, -1.0)
 
const Scalar SCALAR_ZERO = static_cast<Scalar>(0.0)
 
const Scalar SCALAR_ONE = static_cast<Scalar>(1.0)
 
const Scalar SCALAR_MINUS_ONE = static_cast<Scalar>(-1.0)
 
const char UPPER = 'U'
 
const char LOWER = 'L'
 
const Real au2K = 315774.67
 
const Real PI = 3.141592653589793
 
std::map< MPI_Comm,
std::vector< int > > 
commGlobRanks
 
const int LENGTH_VAR_NAME = 8
 
const int LENGTH_DBL_DATA = 16
 
const int LENGTH_INT_DATA = 5
 
const int LENGTH_VAR_UNIT = 6
 
const int LENGTH_DBL_PREC = 8
 
const int LENGTH_VAR_DATA = 16
 
std::stack< std::string > callStack
 

Detailed Description

The main namespace.

Function Documentation

template<class F >
void PEXSI::DistSparseMatMultGlobalVec ( const F  alpha,
const DistSparseMatrix< F > &  AMat,
const NumVec< F > &  B,
const F  beta,
NumVec< F > &  C 
)

Multiply a DistSparseMatrix with a vector that is distributed across all processors participating the operation.

Perform

\[ C = \beta C + \alpha A B \]

**Note** It is not assumed that the matrix is symmetric.

Parameters
[in]AMatDistributed sparse matrix in CSC format.
[in]BDense vector with the same values across all procesors. The size of the vector is the same as the size of the matrix A.
[in,out]CDense vector with the same values across all procesors. The size of the vector is the same as the size of the matrix A and B.
int PEXSI::GetPoleDensity ( Complex *  zshift,
Complex *  zweight,
int  Npole,
double  temp,
double  gap,
double  deltaE,
double  mu 
)

Pole expansion for the Fermi-Dirac operator.

This is the most commonly used subroutine for the pole expansion, and can be used to compute the shifts and weights for calculating the density matrix, the total energy, and the Hellman-Feynman force.

This routine obtains the expansion

\[ f_{\beta} (z) = \frac{2}{1+e^{\beta z}} \approx \mathrm{Im} \sum_{l=1}^{P} \frac{\omega^{\rho}_l}{z-z_l} \]

Note
The unit of temp,gap,deltaE,mu must be the same.
Parameters
[out]zshiftDimension: Npole. The shifts \(\{z_l\}\).
[out]zweightDimension: Npole. The weights \(\{\omega^{\rho}_l\}\).
[in]NpoleNumber of poles. Must be an even number.
[in]tempTemperature. Temperature equals to \(1/\beta\).
[in]gapThe spectral gap, defined as \(\min_{\varepsilon} |\varepsilon-\mu|\), where \(\varepsilon\) is an eigenvalue.
[in]deltaEThe spectral range, defined as \(\max_{\varepsilon} |\varepsilon-\mu|\), where \(\varepsilon\) is an eigenvalue.
[in]muThe chemical potential.
Returns
  • = 0: successful exit.
  • > 0: unsuccessful.
int PEXSI::GetPoleDensityDrvMu ( Complex *  zshift,
Complex *  zweight,
int  Npole,
double  temp,
double  gap,
double  deltaE,
double  mu 
)

Pole expansion for the derivative of the Fermi-Dirac operator with respect to the chemical potential mu.

This routine can be used to evaluate the derivative of the number of electrons with respect to the chemical potential for the Newton step for updating the chemical potential.

Note that \(f_{\beta}\) does not explicitly contain \(\mu\), so this routine actually computes the expansion

\[ -\frac{\partial f_{\beta}}{\partial z} (z) = 2\beta \frac{e^{\beta z}}{(1+e^{\beta z})^2} \approx \mathrm{Im} \sum_{l=1}^{P} \frac{\omega^{\mu}_l}{z-z_l} \]

Note
The unit of temp,gap,deltaE,mu must be the same.
Parameters
[out]zshiftDimension: Npole. The shifts \(\{z_l\}\).
[out]zweightDimension: Npole. The weights \(\{\omega^{\mu}_l\}\).
[in]NpoleNumber of poles. Must be an even number.
[in]tempTemperature. Temperature equals to \(1/\beta\).
[in]gapThe spectral gap, defined as \(\min_{\varepsilon} |\varepsilon-\mu|\), where \(\varepsilon\) is an eigenvalue.
[in]deltaEThe spectral range, defined as \(\max_{\varepsilon} |\varepsilon-\mu|\), where \(\varepsilon\) is an eigenvalue.
[in]muThe chemical potential.
Returns
  • = 0: successful exit.
  • > 0: unsuccessful.
int PEXSI::GetPoleDensityDrvT ( Complex *  zshift,
Complex *  zweight,
int  Npole,
double  temp,
double  gap,
double  deltaE,
double  mu 
)

Pole expansion for the derivative of the Fermi-Dirac operator with respect to the temperature T \((1/\beta)\).

This routine can be used to extrapolate the number of electrons from a finite temperature calculation to a zero temperature calculation, using the derivative information. However, this functionality is not used anymore in the current version of PEXSI.

\[ \frac{\partial f_{\beta}}{\partial (1/\beta)} (z) = 2 \beta^2 z \frac{e^{\beta z}}{(1+e^{\beta z})^2} \approx \mathrm{Im} \sum_{l=1}^{P} \frac{\omega^{T}_l}{z-z_l} \]

Note
The unit of temp,gap,deltaE,mu must be the same.
Parameters
[out]zshiftDimension: Npole. The shifts \(\{z_l\}\).
[out]zweightDimension: Npole. The weights \(\{\omega^{T}_l\}\).
[in]NpoleNumber of poles. Must be an even number.
[in]tempTemperature. Temperature equals to \(1/\beta\).
[in]gapThe spectral gap, defined as \(\min_{\varepsilon} |\varepsilon-\mu|\), where \(\varepsilon\) is an eigenvalue.
[in]deltaEThe spectral range, defined as \(\max_{\varepsilon} |\varepsilon-\mu|\), where \(\varepsilon\) is an eigenvalue.
[in]muThe chemical potential.
Returns
  • = 0: successful exit.
  • > 0: unsuccessful.
int PEXSI::GetPoleDensityUpdate ( Complex *  zshift,
Complex *  zweight,
int  Npole,
double  temp,
double  gap,
double  deltaE,
double  mu,
double  dmu 
)

Pole expansion for the Fermi-Dirac operator and update the weight at mu+dmu.

The shift is given at chemical potential mu, while the weight is given at mu+dmu.

Note
  • This is used to evaluate the number of electrons at mu+dmu without recomputing the pole expansion. dmu should be on the order of \(k_BT\) in order to be accurate.
  • All units (temperature, gap, deltaE) should be the same. Without specification they should all be Hartree (au).
Parameters
[out]zshiftDimension: Npole. The shifts \(\{z_l\}\).
[out]zweightDimension: Npole. The weights \(\{\omega^{\rho}_l\}\).
[in]NpoleNumber of poles. Must be an even number.
[in]tempTemperature. Temperature equals to \(1/\beta\).
[in]gapThe spectral gap, defined as \(\min_{\varepsilon} |\varepsilon-\mu|\), where \(\varepsilon\) is an eigenvalue.
[in]deltaEThe spectral range, defined as \(\max_{\varepsilon} |\varepsilon-\mu|\), where \(\varepsilon\) is an eigenvalue.
[in]muThe chemical potential.
[in]dmuUpdate of chemical potential.
Returns
  • = 0: successful exit.
  • > 0: unsuccessful.
int PEXSI::GetPoleForce ( Complex *  zshift,
Complex *  zweight,
int  Npole,
double  temp,
double  gap,
double  deltaE,
double  mu 
)

Pole expansion for the energy density function.

This routine can be used to compute the Pulay contribution of the atomic force in electronic structure calculations. This term is especially important when basis set is not complete and changes with atomic positions. This routine expands the free energy function

\[ f^{E}_{\beta}(z) = (z+\mu) f_{\beta}(z) \approx \mathrm{Im} \sum_{l=1}^{P} \frac{\omega^{E}_l}{z-z_l} \]

Note
The unit of temp,gap,deltaE,mu must be the same.
Parameters
[out]zshiftDimension: Npole. The shifts \(\{z_l\}\).
[out]zweightDimension: Npole. The weights \(\{\omega^{E}_l\}\).
[in]NpoleNumber of poles. Must be an even number.
[in]tempTemperature. Temperature equals to \(1/\beta\).
[in]gapThe spectral gap, defined as \(\min_{\varepsilon} |\varepsilon-\mu|\), where \(\varepsilon\) is an eigenvalue.
[in]deltaEThe spectral range, defined as \(\max_{\varepsilon} |\varepsilon-\mu|\), where \(\varepsilon\) is an eigenvalue.
[in]muThe chemical potential.
Returns
  • = 0: successful exit.
  • > 0: unsuccessful.
int PEXSI::GetPoleForceUpdate ( Complex *  zshift,
Complex *  zweight,
int  Npole,
double  temp,
double  gap,
double  deltaE,
double  mu,
double  dmu 
)

Pole expansion for the energy density function.

Similar to GetPoleForce but obtain the weights using the update formula

int PEXSI::GetPoleFunc ( Complex(*)(Complex, double, double)  func,
Complex *  zshift,
Complex *  zweight,
int *  Npole,
double *  temp,
double *  gap,
double *  deltaE,
double *  mu 
)

Compute the pole expansion.

Generate the poles and weights for any function f that shares the same analytic structure with the Fermi-Dirac distribution with chemical potential mu and inverse temperature beta.

NOTE: All units (temperature, gap, deltaE) should be the same. Without specification they should all be Hartree (au).

Example: Pseudocode (MATLAB notation) using pole expansion to reconstruct the electron density. NOTE: mu is included in zshift. Rho = zeros(N, 1); for l = 1 : Npoles Rho = Rho + diag(imag( zweight(l) * inv(H - zshift(l)*eye(N)))); end

Reference:

L. Lin, J. Lu, L. Ying and W. E, Pole-based approximation of the Fermi-Dirac function, Chin. Ann. Math. 30B, 729, 2009

Parameters
[in]funcinput function to be expanded by pole expansion
[out]zshiftComplex shift of poles.
[out]zweightWeight of poles.
[in]Npolethe number of poles to be used.
[in]temp
[in]gapEnergy gap defined to be min(abs(EV-mu)). EV is the eigenvalue set of Hamiltonian
[in]deltaESpectrum width defined to be max(EV)-min(EV). EV is the eigenvalue set of Hamiltonian.
[in]muChemical potential.
int PEXSI::GetPoleHelmholtz ( Complex *  zshift,
Complex *  zweight,
int  Npole,
double  temp,
double  gap,
double  deltaE,
double  mu 
)

Pole expansion for the Helmholtz free energy function.

This routine can be used to compute the (Helmholtz) free energy when finite temperature effect exists. This is especially important for metallic system and other small gapped systems. This routine expands the free energy function

\[ f^{\mathcal{F}}_{\beta}(z) = -\frac{2}{\beta} \log (1 + e^{-\beta z}) \approx \mathrm{Im} \sum_{l=1}^{P} \frac{\omega^{\mathcal{F}}_l}{z-z_l} \]

Note
The unit of temp,gap,deltaE,mu must be the same.
Parameters
[out]zshiftDimension: Npole. The shifts \(\{z_l\}\).
[out]zweightDimension: Npole. The weights \(\{\omega^{\mathcal{F}}_l\}\).
[in]NpoleNumber of poles. Must be an even number.
[in]tempTemperature. Temperature equals to \(1/\beta\).
[in]gapThe spectral gap, defined as \(\min_{\varepsilon} |\varepsilon-\mu|\), where \(\varepsilon\) is an eigenvalue.
[in]deltaEThe spectral range, defined as \(\max_{\varepsilon} |\varepsilon-\mu|\), where \(\varepsilon\) is an eigenvalue.
[in]muThe chemical potential.
Returns
  • = 0: successful exit.
  • > 0: unsuccessful.
int PEXSI::GetPoleHelmholtzUpdate ( Complex *  zshift,
Complex *  zweight,
int  Npole,
double  temp,
double  gap,
double  deltaE,
double  mu,
double  dmu 
)

Pole expansion for the Helmholtz free energy function.

Similar to GetPoleHelmholtz but obtain the weights using the update formula

int PEXSI::GetPoleUpdateFunc ( Complex(*)(Complex, double, double)  func,
Complex *  zshift,
Complex *  zweight,
int *  Npole,
double *  temp,
double *  gap,
double *  deltaE,
double *  mu,
double *  dmu 
)

Compute the update of the pole expansion.

Generate the poles and weights for any function f that shares the same analytic structure with the Fermi-Dirac distribution with chemical potential mu and inverse temperature beta.

The shift is given at chemical potential mu, while the weight is given at mu+dmu.

Note
  • This is used to evaluate the number of electrons at mu+dmu without recomputing the pole expansion. dmu should be on the order of \(k_BT\) in order to be accurate.
  • All units (temperature, gap, deltaE) should be the same. Without specification they should all be Hartree (au).
Parameters
[in]funcinput function to be expanded by pole expansion
[out]zshiftComplex shift of poles, evaluated at mu.
[out]zweightWeight of poles, evaluated at mu+dmu.
[in]Npolethe number of poles to be used.
[in]temp
[in]gapEnergy gap defined to be min(abs(EV-mu)). EV is the eigenvalue set of Hamiltonian
[in]deltaESpectrum width defined to be max(EV)-min(EV). EV is the eigenvalue set of Hamiltonian.
[in]muChemical potential.
[in]dmuUpdate of chemical potential.
void PEXSI::LinearInterpolation ( const std::vector< Real > &  x,
const std::vector< Real > &  y,
const std::vector< Real > &  xx,
std::vector< Real > &  yy 
)

Linear interpolates from (x,y) to (xx,yy)

Note:

x and xx must be sorted in ascending order.

if xx[i] < x[0], yy[i] = y[0] xx[i] > x[end-1], yy[i] = y[end-1]

Real PEXSI::MonotoneRootFinding ( const std::vector< Real > &  x,
const std::vector< Real > &  y,
Real  val 
)
inline

Root finding for monotonic non-decreasing functions.

Find the solution to \(y(x) = val\) through a set of tabulated values \(\{(x_i,y_i)\}\). Both \(\{x_i\}\) and \(\{y_i\}\) follow non-decreasing order. The solution is obtained via linear interpolation.

This is an internal routine used for searching the chemical potential.

Parameters
[in]xDimension: N.
[in]yDimension: N.
[in]valReal scalar.
Returns
Root of \(y(x) = val\).