Sparse supernodal LU factorization for general matrices. More...
#include <SparseLU.h>
Sparse supernodal LU factorization for general matrices.
This class implements the supernodal LU factorization for general matrices. It uses the main techniques from the sequential SuperLU package (http://crd-legacy.lbl.gov/~xiaoye/SuperLU/). It handles transparently real and complex arithmetics with single and double precision, depending on the scalar type of your input matrix. The code has been optimized to provide BLAS-3 operations during supernode-panel updates. It benefits directly from the built-in high-performant Eigen BLAS routines. Moreover, when the size of a supernode is very small, the BLAS calls are avoided to enable a better optimization from the compiler. For best performance, you should compile it with NDEBUG flag to avoid the numerous bounds checking on vectors.
An important parameter of this class is the ordering method. It is used to reorder the columns (and eventually the rows) of the matrix to reduce the number of new elements that are created during numerical factorization. The cheapest method available is COLAMD. See the OrderingMethods module for the list of built-in and external ordering methods.
Simple example with key steps
VectorXd x(n), b(n); SparseMatrix<double, ColMajor> A; SparseLU<SparseMatrix<scalar, ColMajor>, COLAMDOrdering<Index> > solver; // fill A and b; // Compute the ordering permutation vector from the structural pattern of A solver.analyzePattern(A); // Compute the numerical factorization solver.factorize(A); //Use the factors to solve the linear system x = solver.solve(b);
_MatrixType | The type of the sparse matrix. It must be a column-major SparseMatrix<> |
_OrderingType | The ordering method to use, either AMD, COLAMD or METIS. Default is COLMAD |
Definition at line 73 of file SparseLU.h.
typedef internal::SparseLUImpl<Scalar, Index> Eigen::SparseLU< _MatrixType, _OrderingType >::Base |
Definition at line 86 of file SparseLU.h.
typedef MatrixType::Index Eigen::SparseLU< _MatrixType, _OrderingType >::Index |
Definition at line 80 of file SparseLU.h.
typedef Matrix<Index,Dynamic,1> Eigen::SparseLU< _MatrixType, _OrderingType >::IndexVector |
Reimplemented from Eigen::internal::SparseLUImpl< _MatrixType::Scalar, _MatrixType::Index >.
Definition at line 84 of file SparseLU.h.
typedef _MatrixType Eigen::SparseLU< _MatrixType, _OrderingType >::MatrixType |
Reimplemented from Eigen::internal::SparseLUImpl< _MatrixType::Scalar, _MatrixType::Index >.
Definition at line 76 of file SparseLU.h.
typedef SparseMatrix<Scalar,ColMajor,Index> Eigen::SparseLU< _MatrixType, _OrderingType >::NCMatrix |
Definition at line 81 of file SparseLU.h.
typedef _OrderingType Eigen::SparseLU< _MatrixType, _OrderingType >::OrderingType |
Definition at line 77 of file SparseLU.h.
typedef PermutationMatrix<Dynamic, Dynamic, Index> Eigen::SparseLU< _MatrixType, _OrderingType >::PermutationType |
Definition at line 85 of file SparseLU.h.
typedef MatrixType::RealScalar Eigen::SparseLU< _MatrixType, _OrderingType >::RealScalar |
Reimplemented from Eigen::internal::SparseLUImpl< _MatrixType::Scalar, _MatrixType::Index >.
Definition at line 79 of file SparseLU.h.
typedef MatrixType::Scalar Eigen::SparseLU< _MatrixType, _OrderingType >::Scalar |
Definition at line 78 of file SparseLU.h.
typedef Matrix<Scalar,Dynamic,1> Eigen::SparseLU< _MatrixType, _OrderingType >::ScalarVector |
Reimplemented from Eigen::internal::SparseLUImpl< _MatrixType::Scalar, _MatrixType::Index >.
Definition at line 83 of file SparseLU.h.
typedef internal::MappedSuperNodalMatrix<Scalar, Index> Eigen::SparseLU< _MatrixType, _OrderingType >::SCMatrix |
Definition at line 82 of file SparseLU.h.
Eigen::SparseLU< _MatrixType, _OrderingType >::SparseLU | ( | ) | [inline] |
Definition at line 89 of file SparseLU.h.
Eigen::SparseLU< _MatrixType, _OrderingType >::SparseLU | ( | const MatrixType & | matrix | ) | [inline] |
Definition at line 93 of file SparseLU.h.
Eigen::SparseLU< _MatrixType, _OrderingType >::~SparseLU | ( | ) | [inline] |
Definition at line 99 of file SparseLU.h.
Eigen::SparseLU< _MatrixType, _OrderingType >::SparseLU | ( | const SparseLU< _MatrixType, _OrderingType > & | ) | [private] |
bool Eigen::SparseLU< _MatrixType, _OrderingType >::_solve | ( | const MatrixBase< Rhs > & | B, |
MatrixBase< Dest > & | X_base | ||
) | const [inline] |
Definition at line 222 of file SparseLU.h.
Scalar Eigen::SparseLU< _MatrixType, _OrderingType >::absDeterminant | ( | ) | [inline] |
Definition at line 258 of file SparseLU.h.
void Eigen::SparseLU< MatrixType, OrderingType >::analyzePattern | ( | const MatrixType & | mat | ) |
Compute the column permutation to minimize the fill-in
Definition at line 415 of file SparseLU.h.
Index Eigen::SparseLU< _MatrixType, _OrderingType >::cols | ( | void | ) | const [inline] |
Definition at line 121 of file SparseLU.h.
const PermutationType& Eigen::SparseLU< _MatrixType, _OrderingType >::colsPermutation | ( | ) | const [inline] |
Definition at line 161 of file SparseLU.h.
void Eigen::SparseLU< _MatrixType, _OrderingType >::compute | ( | const MatrixType & | matrix | ) | [inline] |
Compute the symbolic and numeric factorization of the input sparse matrix. The input matrix should be in column-major storage.
Definition at line 112 of file SparseLU.h.
Scalar Eigen::SparseLU< _MatrixType, _OrderingType >::determinant | ( | ) | [inline] |
Definition at line 340 of file SparseLU.h.
void Eigen::SparseLU< MatrixType, OrderingType >::factorize | ( | const MatrixType & | matrix | ) |
= 0: successful factorization
> 0: if info = i, and i is
<= A->ncol: U(i,i) is exactly zero. The factorization has been completed, but the factor U is exactly singular, and division by zero will occur if it is used to solve a system of equations.
> A->ncol: number of bytes allocated when memory allocation failure occurred, plus A->ncol. If lwork = -1, it is the estimated amount of space needed, plus A->ncol.
Definition at line 498 of file SparseLU.h.
ComputationInfo Eigen::SparseLU< _MatrixType, _OrderingType >::info | ( | ) | const [inline] |
Reports whether previous computation was successful.
Success
if computation was succesful, NumericalIssue
if the LU factorization reports a problem, zero diagonal for instance InvalidInput
if the input matrix is invalidDefinition at line 207 of file SparseLU.h.
void Eigen::SparseLU< _MatrixType, _OrderingType >::initperfvalues | ( | ) | [inline, protected] |
Definition at line 363 of file SparseLU.h.
void Eigen::SparseLU< _MatrixType, _OrderingType >::isSymmetric | ( | bool | sym | ) | [inline] |
Indicate that the pattern of the input matrix is symmetric
Definition at line 123 of file SparseLU.h.
std::string Eigen::SparseLU< _MatrixType, _OrderingType >::lastErrorMessage | ( | ) | const [inline] |
Definition at line 216 of file SparseLU.h.
Scalar Eigen::SparseLU< _MatrixType, _OrderingType >::logAbsDeterminant | ( | ) | const [inline] |
Definition at line 288 of file SparseLU.h.
SparseLUMatrixLReturnType<SCMatrix> Eigen::SparseLU< _MatrixType, _OrderingType >::matrixL | ( | ) | const [inline] |
SparseLUMatrixUReturnType<SCMatrix,MappedSparseMatrix<Scalar,ColMajor,Index> > Eigen::SparseLU< _MatrixType, _OrderingType >::matrixU | ( | ) | const [inline] |
Index Eigen::SparseLU< _MatrixType, _OrderingType >::rows | ( | void | ) | const [inline] |
Definition at line 120 of file SparseLU.h.
const PermutationType& Eigen::SparseLU< _MatrixType, _OrderingType >::rowsPermutation | ( | ) | const [inline] |
Definition at line 153 of file SparseLU.h.
void Eigen::SparseLU< _MatrixType, _OrderingType >::setPivotThreshold | ( | const RealScalar & | thresh | ) | [inline] |
Set the threshold used for a diagonal entry to be an acceptable pivot.
Definition at line 166 of file SparseLU.h.
Scalar Eigen::SparseLU< _MatrixType, _OrderingType >::signDeterminant | ( | ) | [inline] |
Definition at line 312 of file SparseLU.h.
void Eigen::SparseLU< _MatrixType, _OrderingType >::simplicialfactorize | ( | const MatrixType & | matrix | ) |
const internal::solve_retval<SparseLU, Rhs> Eigen::SparseLU< _MatrixType, _OrderingType >::solve | ( | const MatrixBase< Rhs > & | B | ) | const [inline] |
Definition at line 178 of file SparseLU.h.
const internal::sparse_solve_retval<SparseLU, Rhs> Eigen::SparseLU< _MatrixType, _OrderingType >::solve | ( | const SparseMatrixBase< Rhs > & | B | ) | const [inline] |
Definition at line 191 of file SparseLU.h.
bool Eigen::SparseLU< _MatrixType, _OrderingType >::m_analysisIsOk [protected] |
Definition at line 377 of file SparseLU.h.
Index Eigen::SparseLU< _MatrixType, _OrderingType >::m_detPermC [protected] |
Definition at line 394 of file SparseLU.h.
Index Eigen::SparseLU< _MatrixType, _OrderingType >::m_detPermR [protected] |
Definition at line 394 of file SparseLU.h.
RealScalar Eigen::SparseLU< _MatrixType, _OrderingType >::m_diagpivotthresh [protected] |
Definition at line 392 of file SparseLU.h.
IndexVector Eigen::SparseLU< _MatrixType, _OrderingType >::m_etree [protected] |
Definition at line 384 of file SparseLU.h.
bool Eigen::SparseLU< _MatrixType, _OrderingType >::m_factorizationIsOk [protected] |
Definition at line 376 of file SparseLU.h.
Base::GlobalLU_t Eigen::SparseLU< _MatrixType, _OrderingType >::m_glu [protected] |
Definition at line 386 of file SparseLU.h.
ComputationInfo Eigen::SparseLU< _MatrixType, _OrderingType >::m_info [mutable, protected] |
Definition at line 374 of file SparseLU.h.
bool Eigen::SparseLU< _MatrixType, _OrderingType >::m_isInitialized [protected] |
Definition at line 375 of file SparseLU.h.
std::string Eigen::SparseLU< _MatrixType, _OrderingType >::m_lastError [protected] |
Definition at line 378 of file SparseLU.h.
SCMatrix Eigen::SparseLU< _MatrixType, _OrderingType >::m_Lstore [protected] |
Definition at line 380 of file SparseLU.h.
NCMatrix Eigen::SparseLU< _MatrixType, _OrderingType >::m_mat [protected] |
Definition at line 379 of file SparseLU.h.
Index Eigen::SparseLU< _MatrixType, _OrderingType >::m_nnzL [protected] |
Definition at line 393 of file SparseLU.h.
Index Eigen::SparseLU< _MatrixType, _OrderingType >::m_nnzU [protected] |
Definition at line 393 of file SparseLU.h.
internal::perfvalues<Index> Eigen::SparseLU< _MatrixType, _OrderingType >::m_perfv [protected] |
Definition at line 391 of file SparseLU.h.
PermutationType Eigen::SparseLU< _MatrixType, _OrderingType >::m_perm_c [protected] |
Definition at line 382 of file SparseLU.h.
PermutationType Eigen::SparseLU< _MatrixType, _OrderingType >::m_perm_r [protected] |
Definition at line 383 of file SparseLU.h.
bool Eigen::SparseLU< _MatrixType, _OrderingType >::m_symmetricmode [protected] |
Definition at line 389 of file SparseLU.h.
MappedSparseMatrix<Scalar,ColMajor,Index> Eigen::SparseLU< _MatrixType, _OrderingType >::m_Ustore [protected] |
Definition at line 381 of file SparseLU.h.