PEXSI
 All Classes Namespaces Files Functions Variables Typedefs Pages
Parallel selected inversion for a real symmetric matrix

The parallel selected inversion routine for a real symmetric matrix can be used as follows. This assumes that the size of MPI_COMM_WORLD is nprow * npcol.

...
{
/* Setup the input matrix in distributed compressed sparse column (CSC) format */
...;
/* Initialize PEXSI.
* PPEXSIPlan is a handle communicating with the C++ internal data structure */
PPEXSIPlan plan;
MPI_COMM_WORLD,
nprow,
npcol,
mpirank,
&info );
/* Tuning parameters of PEXSI. The default options is reasonable to
* start, and the parameters in options can be changed. */
PPEXSIOptions options;
/* Load the matrix into the internal data structure */
plan,
options,
nrows,
nnz,
nnzLocal,
numColLocal,
colptrLocal,
rowindLocal,
AnzvalLocal,
1, // S is an identity matrix here
NULL, // S is an identity matrix here
&info );
/* Factorize the matrix symbolically */
plan,
options,
&info );
/* Main routine for computing selected elements and save into AinvnzvalLocal */
plan,
options,
AnzvalLocal,
AinvnzvalLocal,
&info );
...;
/* Post processing AinvnzvalLocal */
...;
plan,
&info );
}

This routine computes the selected elements of the matrix \(A^{-1}=(H - z S)^{-1}\) in parallel. The input matrix \(H\) follows the Distributed compressed sparse column (CSC) format , defined through the variables colptrLocal, rowindLocal, HnzvalLocal. The input matrix \(S\) can be omitted if it is an identity matrix and by setting isSIdentity=1. If \(S\) is not an identity matrix, the nonzero sparsity pattern is assumed to be the same as the nonzero sparsity pattern of \(H\). Both HnzvalLocal and SnzvalLocal are double precision arrays.

An example is given in driver_pselinv_real.c, which evaluates the selected elements of the inverse of the matrix saved in examples/lap2dr.matrix. See also PPEXSISelInvRealSymmetricMatrix for detailed information of its usage.