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.

PSelInvOptions

A thin interface for passing parameters to set the PSelInv options.

SuperNodeType

A data structure containing the supernodal partitioning of the matrix.

Note
It is the user's responsibility to initialize this data structure after SuperLUMatrix::SymbolicFactorize has been called. This is done using the [SuperLUMatrix::SymbolicToSuperNode](PEXSI::SuperLUMatrix::SymbolicToSuperNode] utility routine.

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.

PMatrix::Create

This static factory routine instantiates the correct PMatrix object type depending on matrix structure. The matrix structure is specified by the SuperLUOptions::Symmetric attribute of the SuperLUOptions data structure.

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";
luOpt.Symmetric = 1;
SuperLUMatrix<Complex> luMat( g );
// Matrix conversion
luMat.DistSparseMatrixToSuperMatrixNRloc( AMat, luOpt );
// Symbolic factorization
luMat.SymbolicFactorize();
// Numerical factorization
luMat.NumericalFactorize();
/****** SELECTED INVERSION ******/
PSelInvOptions selinvOpt;
GridType gPM( comm, nprow, npcol );
SuperNodeType super;
luMat.SymbolicToSuperNode( super );
PMatrix<Complex> * PMloc = PMatrix<Complex>::Create(&gPM, &super, &selinvOpt, &luOpt);
// 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 );
...;
delete PMloc;
}