Procedure for factorization
Before the selected inversion step, the matrix saved in DistSparseMatrix format must first be factorized. In principle this can be done with any \(LDL^T\) factorization or \(LU\) factorization routines. In the current version of PEXSI, SuperLU_DIST v3.3 is used for the \(LU\) factorization.
- Note
- To avoid conflict with other routines in PEXSI, the SuperLU_DIST routines are encapsulated in superlu_dist_interf.cpp. Access to SuperLU_DIST routines are made through a wrapper class SuperLUMatrix.
The basic steps for factorization include:
- Convert a
DistSparseMatrix
into the native format (SuperMatrix
in SuperLU_DIST) of the factorization routine.
- Symbolic factorization.
- Numerical factorization.
Related structures and subroutines
SuperLUGrid
A thin interface for the mpi grid strucutre in SuperLU.
SuperLUOptions
A thin interface for passing parameters to set the SuperLU options.
SuperLUMatrix::DistSparseMatrixToSuperMatrixNRloc
Convert a distributed sparse matrix in compressed sparse column format into the SuperLU compressed row format. The output is saved in the current SuperLUMatrix.
- 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).
SuperLUMatrix::SymbolicFactorize
This routine factorizes the superlu matrix symbolically. Symbolic factorization contains three steps.
- Permute the matrix to reduce fill-in.
- Symbolic factorize the matrix.
- Distribute the matrix into 2D block cyclic format.
This routine is controlled via SuperLUOptions. In particular, the permutation strategy is controlled by SuperLUOptions::ColPerm.
SuperLUMatrix::NumericalFactorize
Performs LU factorization numerically.
Example
{
...;
DistSparseMatrix<Complex> AMat;
...;
SuperLUGrid<Complex> g( comm, nprow, npcol );
SuperLUOptions luOpt;
luOpt.ColPerm = "MMD_AT_PLUS_A";
SuperLUMatrix<Complex> luMat( g );
luMat.DistSparseMatrixToSuperMatrixNRloc( AMat );
luMat.SymbolicFactorize();
luMat.NumericalFactorize();
...;
}
Reuse symbolic factorization
In SuperLU_DIST, the same symbolic factorization can be reused for factorizing different matrices. To reuse the symbolic factorization, one should follow the steps below.
(After symbolic factorization)
- Destroy the
SuperMatrix
.
- Convert another
DistSparseMatrix
into the native format (SuperMatrix
in SuperLU_DIST) of the factorization routine.
- Redistribute the matrix into 2D block cyclic format.
- Numerical factorization.
Related structures and subroutines
SuperLUMatrix::DestroyAOnly
Releases the data in A but keeps other data, such as LUstruct.
This allows one to perform factorization of matrices of the same pattern, such as the option
fact = SamePattern_SameRowPerm
in SuperLU_DIST.
SuperLUMatrix::Distribute
Distribute redistrbutes the SuperMatrix in parallel so that it is ready for the numerical factorization.
Example
{
...;
DistSparseMatrix<Complex> AMat;
...;
SuperLUGrid<Complex> g( comm, nprow, npcol );
SuperLUOptions luOpt;
luOpt.ColPerm = "MMD_AT_PLUS_A";
SuperLUMatrix<Complex> luMat( g );
luMat.DistSparseMatrixToSuperMatrixNRloc( AMat );
luMat.SymbolicFactorize();
luMat.DestroyAOnly();
DistSparseMatrix<Complex> BMat;
...;
luMat.DistSparseMatrixToSuperMatrixNRloc( BMat );
luMat.Distribute();
luMat.NumericalFactorize();
...;
}