PEXSI
 All Classes Namespaces Files Functions Variables Typedefs Pages
Factorization

Table of Contents

Procedure for factorization

Before the selected inversion step, the matrix saved in DistSparseMatrix format must first be factorized. In principle, for symmetric matrices, this can be done with any \(LDL^T\) factorization or \(LU\) factorization routines. For unsymmetric matrices, only the latter can be used. 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:

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.

SuperLUMatrix::SymbolicFactorize

This routine factorizes the superlu matrix symbolically. Symbolic factorization contains three steps.

This routine is controlled via SuperLUOptions. In particular, the column permutation strategy is controlled by SuperLUOptions::ColPerm. Similarly, the row permutation strategy is controlled by SuperLUOptions::RowPerm.

SuperLUMatrix::NumericalFactorize

Performs LU factorization numerically.

Example

#include "ppexsi.hpp"
{
...;
// Construct AMat
DistSparseMatrix<Complex> AMat;
...;
// 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, luOpt );
// Symbolic factorization
luMat.SymbolicFactorize();
// Numerical factorization
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)

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

#include "ppexsi.hpp"
{
...;
// Construct AMat
DistSparseMatrix<Complex> AMat;
...;
// 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, luOpt );
// Symbolic factorization
luMat.SymbolicFactorize();
// Destroy the SuperMatrix saved in luMat.
luMat.DestroyAOnly();
// Construct another matrix BMat with the same sparsity pattern as A.
DistSparseMatrix<Complex> BMat;
...;
// Matrix conversion
luMat.DistSparseMatrixToSuperMatrixNRloc( BMat, luOpt );
// Redistribute into 2D block cyclic format.
luMat.Distribute();
// Numerical factorization
luMat.NumericalFactorize();
...;
}