PEXSI
 All Classes Namespaces Files Functions Variables Typedefs Pages
Selected Inversion

Table of Contents

Procedure for Selected Inversion

After factorizing a SuperLUMatrix luMat (See the factorization page for information on how to perform factorization), the parallel selected inversion can be computed.

Note
To provide a layer of abstraction from the matrix format used during the factorization, the PMatrix class is used during the selected inversion.
All major operations of PMatrix, including the selected inversion, are defined directly as member functions of PMatrix.

The basic steps for selected inversion are:

Related structures and subroutines

GridType

A thin interface for the mpi grid strucutre in PSelInv. GridType should be consistent with the grid used by SuperLU.

Note
It is the user's responsibility to enforce the coherence between SuperLUGrid and GridType.

PMatrix

PMatrix contains the main data structure and computational routines for parallel selected inversion.

SuperLUMatrix::LUstructToPMatrix;

Converts a compressed row format SuperLUMatrix into a PMatrix object, using the compressed column format used by PSelInv.

Note
Although LU factorization is used, the routine assumes that the matrix is strictly symmetric, and therefore the compressed sparse row (CSR) format, used by SuperLU_DIST, gives exactly the same matrix as formed by the compresed sparse column format (CSC).

PMatrix::ConstructCommunicationPattern

This routine creates the MPI_Communicators and communication pattern used later by both PreSelInv and SelInv routines. The supernodal elimination tree is exploited to add an additional level of parallelism between supernodes. ConstructCommunicationPattern_P2p is called by default.

PMatrix::PreSelInv

PreSelInv prepares the structure in L and U so that SelInv only involves matrix-matrix multiplication.

Note
PreSelInv assumes that PEXSI::PMatrix::ConstructCommunicationPattern has been executed.

PMatrix::SelInv

SelInv preforms the actual parallel selected inversion. SelInv_P2p is called by default.

Note
SelInv assumes that PreSelInv has been executed.

PMatrix::PMatrixToDistSparseMatrix

Converts the PMatrix back to the original DistSparseMatrix format.

Example

#include "ppexsi.hpp"
{
...;
// Construct AMat
DistSparseMatrix<Complex> AMat;
...;
/****** NUMERICAL FACTORIZATION ******/
// Setup SuperLU
SuperLUGrid<Complex> g( comm, nprow, npcol );
SuperLUOptions luOpt;
luOpt.ColPerm = "MMD_AT_PLUS_A";
SuperLUMatrix<Complex> luMat( g );
// Matrix conversion
luMat.DistSparseMatrixToSuperMatrixNRloc( AMat );
// Symbolic factorization
luMat.SymbolicFactorize();
// Numerical factorization
luMat.NumericalFactorize();
/****** SELECTED INVERSION ******/
PMatrix<Complex> PMloc;
// Conversion to PMatrix
luMat.LUstructToPMatrix( PMloc );
//Create the communication pattern
PMloc.ConstructCommunicationPattern();
//Prepare for parallel selected inversion
PMloc.PreSelInv();
//Perform the parallel selected inversion
PMloc.SelInv();
//Get the result back in DistSparseMatrix format
DistSparseMatrix<Scalar> Ainv;
PMloc.PMatrixToDistSparseMatrix( Ainv );
...;
}