PEXSI
 All Classes Namespaces Files Functions Variables Typedefs Pages
Data type

Table of Contents

Basic data type

To enhance potential transplantability of the code, some basic data types are constants are defined in environment.hpp.

The basic data types int and double are redefined as Int and Real, in order to improve compatibility for different architecture especially on 64-bit machines (not implemented yet). The 64-bit long integer int64_t is also redefined as LongInt.

The complex arithmetic is treated using the standard C++ <complex> library. The complex data type is std::complex<double>, and is redefined as Complex in the implementation.

typedef int Int;
typedef int64_t LongInt;
typedef double Real;
typedef std::complex<double> Complex;

NumVec, NumMat, NumTns

The design of PEXSI tries to eliminate as much as possible the direct usage of pointers. This helps reducing memory leak. Commonly used pointers are wrapped into different classes.

The most commonly used are NumVec, NumMat, and NumTns, which are wrappers for 1D array (vector), 2D array (matrix) and 3D array (tensor), respectively. The arrays are always saved contiguously in memory as a 1D array. Column-major ordering is assumed for arrays of all dimensions, which makes the arrays directly compatible with BLAS/LAPACK libraries.

These wrapper classes can both actually own an array (by specifying owndata_=true), and just view an array (by specifying owndata_=false). Elements of arrays can be accessed directly as in FORTRAN convention, such as A(i) (NumVec), A(i,j) (NumMat), and A(i,j,k) (NumTns).

The underlying pointer can be accessed using the member function Data().

Commonly used wrapper classes

NumVec:

typedef NumVec<bool> BolNumVec;
typedef NumVec<Int> IntNumVec;
typedef NumVec<Real> DblNumVec;
typedef NumVec<Complex> CpxNumVec;

NumMat:

typedef NumMat<bool> BolNumMat;
typedef NumMat<Int> IntNumMat;
typedef NumMat<Real> DblNumMat;
typedef NumMat<Complex> CpxNumMat;

NumTns:

typedef NumTns<bool> BolNumTns;
typedef NumTns<Int> IntNumTns;
typedef NumTns<Real> DblNumTns;
typedef NumTns<Complex> CpxNumTns;

Distributed compressed sparse column (CSC) format

We use the Compressed Sparse Column (CSC) format, a.k.a. the Compressed Column Storage (CCS) format for storing a sparse matrix. See

http://netlib.org/linalg/html_templates/node92.html

for the explanation of the format.

We adopt the following convention for distributed CSC format for saving a sparse matrix on distributed memory parallel machines. We assume the number of processor is \(P\), the number of rows and columns of the matrix is \(N\). The class for distributed memory CSC format matrix is DistSparseMatrix.