PEXSI
 All Classes Namespaces Files Functions Variables Typedefs Pages
Classes | Namespaces | Functions | Variables
utility.hpp File Reference

Various utility subroutines. More...

#include <stdlib.h>
#include "environment.hpp"
#include "tinyvec.hpp"
#include "NumVec.hpp"
#include "NumMat.hpp"
#include "NumTns.hpp"
#include "sparse_matrix.hpp"
#include "mpi_interf.hpp"
#include "utility_impl.hpp"

Go to the source code of this file.

Classes

struct  PEXSI::IndexComp< T >
 

Namespaces

 PEXSI
 The main namespace.
 

Functions

const std::vector< Int > PEXSI::NO_MASK (1)
 
Int PEXSI::PrintBlock (std::ostream &os, const std::string name)
 
Int PEXSI::Print (std::ostream &os, const std::string name)
 
Int PEXSI::Print (std::ostream &os, const char *name)
 
Int PEXSI::Print (std::ostream &os, const std::string name, std::string val)
 
Int PEXSI::Print (std::ostream &os, const std::string name, const char *val)
 
Int PEXSI::Print (std::ostream &os, const std::string name, Real val)
 
Int PEXSI::Print (std::ostream &os, const char *name, Real val)
 
Int PEXSI::Print (std::ostream &os, const std::string name, Real val, const std::string unit)
 
Int PEXSI::Print (std::ostream &os, const char *name, Real val, const char *unit)
 
Int PEXSI::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 PEXSI::Print (std::ostream &os, const char *name1, Real val1, const char *unit1, char *name2, Real val2, char *unit2)
 
Int PEXSI::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 PEXSI::Print (std::ostream &os, const char *name1, Int val1, const char *unit1, char *name2, Real val2, char *unit2)
 
Int PEXSI::Print (std::ostream &os, const char *name1, Int val1, const char *name2, Real val2, char *name3, Real val3)
 
Int PEXSI::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 PEXSI::Print (std::ostream &os, std::string name, Int val)
 
Int PEXSI::Print (std::ostream &os, const char *name, Int val)
 
Int PEXSI::Print (std::ostream &os, const std::string name, Int val, const std::string unit)
 
Int PEXSI::Print (std::ostream &os, const char *name, Int val, const std::string unit)
 
Int PEXSI::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 PEXSI::Print (std::ostream &os, const char *name1, Int val1, const char *unit1, char *name2, Int val2, char *unit2)
 
Int PEXSI::Print (std::ostream &os, const std::string name, bool val)
 
Int PEXSI::Print (std::ostream &os, const char *name, bool val)
 
Int PEXSI::Print (std::ostream &os, const char *name1, Index3 val)
 
Int PEXSI::Print (std::ostream &os, const char *name1, Point3 val)
 
Int PEXSI::Print (std::ostream &os, const char *name1, Int val1, const char *name2, Point3 val)
 
template<class F >
std::ostream & PEXSI::operator<< (std::ostream &os, const std::vector< F > &vec)
 
template<class F >
std::ostream & PEXSI::operator<< (std::ostream &os, const NumVec< F > &vec)
 
template<class F >
std::ostream & PEXSI::operator<< (std::ostream &os, const NumMat< F > &mat)
 
template<class F >
std::ostream & PEXSI::operator<< (std::ostream &os, const NumTns< F > &tns)
 
template<typename T >
Int PEXSI::serialize (const T &val, std::ostream &os, const std::vector< Int > &mask)
 
template<typename T >
Int PEXSI::deserialize (T &val, std::istream &is, const std::vector< Int > &mask)
 
Int PEXSI::serialize (const bool &val, std::ostream &os, const std::vector< Int > &mask)
 
Int PEXSI::deserialize (bool &val, std::istream &is, const std::vector< Int > &mask)
 
Int PEXSI::serialize (const char &val, std::ostream &os, const std::vector< Int > &mask)
 
Int PEXSI::deserialize (char &val, std::istream &is, const std::vector< Int > &mask)
 
Int PEXSI::combine (char &val, char &ext)
 
Int PEXSI::serialize (const Int &val, std::ostream &os, const std::vector< Int > &mask)
 
Int PEXSI::deserialize (Int &val, std::istream &is, const std::vector< Int > &mask)
 
Int PEXSI::combine (Int &val, Int &ext)
 
Int PEXSI::serialize (const LongInt &val, std::ostream &os, const std::vector< Int > &mask)
 
Int PEXSI::deserialize (LongInt &val, std::istream &is, const std::vector< Int > &mask)
 
Int PEXSI::combine (LongInt &val, LongInt &ext)
 
Int PEXSI::serialize (const Real &val, std::ostream &os, const std::vector< Int > &mask)
 
Int PEXSI::deserialize (Real &val, std::istream &is, const std::vector< Int > &mask)
 
Int PEXSI::combine (Real &val, Real &ext)
 
Int PEXSI::serialize (const Complex &val, std::ostream &os, const std::vector< Int > &mask)
 
Int PEXSI::deserialize (Complex &val, std::istream &is, const std::vector< Int > &mask)
 
Int PEXSI::combine (Complex &val, Complex &ext)
 
Int PEXSI::serialize (const Index3 &val, std::ostream &os, const std::vector< Int > &mask)
 
Int PEXSI::deserialize (Index3 &val, std::istream &is, const std::vector< Int > &mask)
 
Int PEXSI::combine (Index3 &val, Index3 &ext)
 
Int PEXSI::serialize (const Point3 &val, std::ostream &os, const std::vector< Int > &mask)
 
Int PEXSI::deserialize (Point3 &val, std::istream &is, const std::vector< Int > &mask)
 
Int PEXSI::combine (Point3 &val, Point3 &ext)
 
template<class T >
Int PEXSI::serialize (const std::vector< T > &val, std::ostream &os, const std::vector< Int > &mask)
 
template<class T >
Int PEXSI::deserialize (std::vector< T > &val, std::istream &is, const std::vector< Int > &mask)
 
template<class T >
Int PEXSI::combine (std::vector< T > &val, std::vector< T > &ext)
 
template<class T >
Int PEXSI::serialize (const std::set< T > &val, std::ostream &os, const std::vector< Int > &mask)
 
template<class T >
Int PEXSI::deserialize (std::set< T > &val, std::istream &is, const std::vector< Int > &mask)
 
template<class T >
Int PEXSI::combine (std::set< T > &val, std::set< T > &ext)
 
template<class T , class S >
Int PEXSI::serialize (const std::map< T, S > &val, std::ostream &os, const std::vector< Int > &mask)
 
template<class T , class S >
Int PEXSI::deserialize (std::map< T, S > &val, std::istream &is, const std::vector< Int > &mask)
 
template<class T , class S >
Int PEXSI::combine (std::map< T, S > &val, std::map< T, S > &ext)
 
template<class T , class S >
Int PEXSI::serialize (const std::pair< T, S > &val, std::ostream &os, const std::vector< Int > &mask)
 
template<class T , class S >
Int PEXSI::deserialize (std::pair< T, S > &val, std::istream &is, const std::vector< Int > &mask)
 
template<class T , class S >
Int PEXSI::combine (std::pair< T, S > &val, std::pair< T, S > &ext)
 
Int PEXSI::serialize (const IntNumVec &val, std::ostream &os, const std::vector< Int > &mask)
 
Int PEXSI::deserialize (IntNumVec &val, std::istream &is, const std::vector< Int > &mask)
 
Int PEXSI::combine (IntNumVec &val, IntNumVec &ext)
 
Int PEXSI::serialize (const IntNumMat &val, std::ostream &os, const std::vector< Int > &mask)
 
Int PEXSI::deserialize (IntNumMat &val, std::istream &is, const std::vector< Int > &mask)
 
Int PEXSI::combine (IntNumMat &val, IntNumMat &ext)
 
Int PEXSI::serialize (const IntNumTns &val, std::ostream &os, const std::vector< Int > &mask)
 
Int PEXSI::deserialize (IntNumTns &val, std::istream &is, const std::vector< Int > &mask)
 
Int PEXSI::combine (IntNumTns &val, IntNumTns &ext)
 
Int PEXSI::serialize (const DblNumVec &val, std::ostream &os, const std::vector< Int > &mask)
 
Int PEXSI::deserialize (DblNumVec &val, std::istream &is, const std::vector< Int > &mask)
 
Int PEXSI::combine (DblNumVec &val, DblNumVec &ext)
 
Int PEXSI::serialize (const DblNumMat &val, std::ostream &os, const std::vector< Int > &mask)
 
Int PEXSI::deserialize (DblNumMat &val, std::istream &is, const std::vector< Int > &mask)
 
Int PEXSI::combine (DblNumMat &val, DblNumMat &ext)
 
Int PEXSI::serialize (const DblNumTns &val, std::ostream &os, const std::vector< Int > &mask)
 
Int PEXSI::deserialize (DblNumTns &val, std::istream &is, const std::vector< Int > &mask)
 
Int PEXSI::combine (DblNumTns &val, DblNumTns &ext)
 
Int PEXSI::serialize (const CpxNumVec &val, std::ostream &os, const std::vector< Int > &mask)
 
Int PEXSI::deserialize (CpxNumVec &val, std::istream &is, const std::vector< Int > &mask)
 
Int PEXSI::combine (CpxNumVec &val, CpxNumVec &ext)
 
Int PEXSI::serialize (const CpxNumMat &val, std::ostream &os, const std::vector< Int > &mask)
 
Int PEXSI::deserialize (CpxNumMat &val, std::istream &is, const std::vector< Int > &mask)
 
Int PEXSI::combine (CpxNumMat &val, CpxNumMat &ext)
 
Int PEXSI::serialize (const CpxNumTns &val, std::ostream &os, const std::vector< Int > &mask)
 
Int PEXSI::deserialize (CpxNumTns &val, std::istream &is, const std::vector< Int > &mask)
 
Int PEXSI::combine (CpxNumTns &val, CpxNumTns &ext)
 
template<class T >
Int PEXSI::serialize (const NumVec< T > &val, std::ostream &os, const std::vector< Int > &mask)
 
template<class T >
Int PEXSI::deserialize (NumVec< T > &val, std::istream &is, const std::vector< Int > &mask)
 
template<class T >
Int PEXSI::combine (NumVec< T > &val, NumVec< T > &ext)
 
template<class T >
Int PEXSI::serialize (const NumMat< T > &val, std::ostream &os, const std::vector< Int > &mask)
 
template<class T >
Int PEXSI::deserialize (NumMat< T > &val, std::istream &is, const std::vector< Int > &mask)
 
template<class T >
Int PEXSI::combine (NumMat< T > &val, NumMat< T > &ext)
 
template<class T >
Int PEXSI::serialize (const NumTns< T > &val, std::ostream &os, const std::vector< Int > &mask)
 
template<class T >
Int PEXSI::deserialize (NumTns< T > &val, std::istream &is, const std::vector< Int > &mask)
 
template<class T >
Int PEXSI::combine (NumTns< T > &val, NumTns< T > &ext)
 
template<class T >
Int PEXSI::serialize (const DistSparseMatrix< T > &val, std::ostream &os, const std::vector< Int > &mask)
 
template<class T >
Int PEXSI::deserialize (DistSparseMatrix< T > &val, std::istream &is, const std::vector< Int > &mask)
 
template<class T >
Int PEXSI::combine (DistSparseMatrix< T > &val, DistSparseMatrix< T > &ext)
 
Int PEXSI::SeparateRead (std::string name, std::istringstream &is)
 
Int PEXSI::SeparateWrite (std::string name, std::ostringstream &os)
 
Int PEXSI::SeparateWriteAscii (std::string name, std::ostringstream &os)
 
Int PEXSI::SharedRead (std::string name, std::istringstream &is)
 
Int PEXSI::SharedWrite (std::string name, std::ostringstream &os)
 
void PEXSI::IdentityCol (Int col, NumVec< Real > &vec)
 
void PEXSI::IdentityCol (Int col, NumVec< Complex > &vec)
 
void PEXSI::IdentityCol (IntNumVec &cols, NumMat< Real > &mat)
 
void PEXSI::IdentityCol (IntNumVec &cols, NumMat< Complex > &mat)
 
void PEXSI::SetRandomSeed (long int seed)
 
Real PEXSI::UniformRandom ()
 
void PEXSI::UniformRandom (NumVec< Real > &vec)
 
void PEXSI::UniformRandom (NumVec< Complex > &vec)
 
void PEXSI::UniformRandom (NumMat< Real > &M)
 
void PEXSI::UniformRandom (NumMat< Complex > &M)
 
void PEXSI::UniformRandom (NumTns< Real > &T)
 
void PEXSI::UniformRandom (NumTns< Complex > &T)
 
void PEXSI::GetTime (Real &t)
 
bool PEXSI::PairLtComparator (const std::pair< Real, Int > &l, const std::pair< Real, Int > &r)
 
bool PEXSI::PairGtComparator (const std::pair< Real, Int > &l, const std::pair< Real, Int > &r)
 
void PEXSI::ReadSparseMatrix (const char *filename, SparseMatrix< Real > &spmat)
 
void PEXSI::ReadDistSparseMatrix (const char *filename, DistSparseMatrix< Real > &pspmat, MPI_Comm comm)
 
void PEXSI::ParaReadDistSparseMatrix (const char *filename, DistSparseMatrix< Real > &pspmat, MPI_Comm comm)
 
void PEXSI::ParaWriteDistSparseMatrix (const char *filename, DistSparseMatrix< Real > &pspmat, MPI_Comm comm)
 
void PEXSI::ReadDistSparseMatrixFormatted (const char *filename, DistSparseMatrix< Real > &pspmat, MPI_Comm comm)
 
template<class F1 , class F2 >
void PEXSI::CopyPattern (const SparseMatrix< F1 > &A, SparseMatrix< F2 > &B)
 
template<typename T >
void PEXSI::GetDiagonal (const DistSparseMatrix< T > &A, NumVec< T > &diag)
 
template<class F1 , class F2 >
void PEXSI::CopyPattern (const DistSparseMatrix< F1 > &A, DistSparseMatrix< F2 > &B)
 
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. More...
 
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) More...
 
Real PEXSI::MonotoneRootFinding (const std::vector< Real > &x, const std::vector< Real > &y, Real val)
 Root finding for monotonic non-decreasing functions. More...
 

Variables

const int PEXSI::LENGTH_VAR_NAME = 8
 
const int PEXSI::LENGTH_DBL_DATA = 16
 
const int PEXSI::LENGTH_INT_DATA = 5
 
const int PEXSI::LENGTH_VAR_UNIT = 6
 
const int PEXSI::LENGTH_DBL_PREC = 8
 
const int PEXSI::LENGTH_VAR_DATA = 16
 

Detailed Description

Various utility subroutines.

Date
2012-09-27