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;

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;

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.

`DistSparseMatrix`

uses FORTRAN convention (1-based) indices for`colptrLocal`

and`rowindLocal`

, i.e. the first row and the first column indices are 1 instead of 0.`mpirank`

follows the standard C convention, i.e. the`mpirank`

for the first processor is 0.- Each processor holds \(\lfloor N/P \rfloor\) consequentive columns, with the exception that the last processor (
`mpirank == P-1`

) holds a all the remaining \(N - (P-1) \lfloor N/P \rfloor\) columns. The first column holds by the i-th processor is \( i \lfloor N/P \rfloor\). The number of columns on each local processor is usually denoted by`numColLocal`

. `colptrLocal`

, which is an integer array of type`IntNumVec`

of dimension`numColLocal + 1`

, stores the pointers to the nonzero row indices and nonzero values in`rowptrLocal`

and`nzvalLocal`

, respectively.`rowindLocal`

, which is an integer array of type`IntNumVec`

of dimension`nnzLocal`

, stores the nonzero row indices in each column.`nzvalLocal`

, which is an array of flexible type (usually`Real`

or`Complex`

)`NumVec`

of dimension`nnzLocal`

, stores the nonzero values in each column.

Generated on Tue Jul 1 2014 14:49:04 for PEXSI by 1.8.5