A sparse LU factorization and solver based on UmfPack. More...
#include <UmfPackSupport.h>
Inherits noncopyable.
Public Types | |
typedef MatrixType::Index | Index |
typedef Matrix< int, MatrixType::RowsAtCompileTime, 1 > | IntColVectorType |
typedef Matrix< int, 1, MatrixType::ColsAtCompileTime > | IntRowVectorType |
typedef SparseMatrix< Scalar > | LUMatrixType |
typedef _MatrixType | MatrixType |
typedef MatrixType::RealScalar | RealScalar |
typedef MatrixType::Scalar | Scalar |
typedef SparseMatrix< Scalar, ColMajor, int > | UmfpackMatrixType |
typedef Matrix< Scalar, Dynamic, 1 > | Vector |
Public Member Functions | |
void | analyzePattern (const MatrixType &matrix) |
Index | cols () const |
void | compute (const MatrixType &matrix) |
Scalar | determinant () const |
void | extractData () const |
void | factorize (const MatrixType &matrix) |
ComputationInfo | info () const |
Reports whether previous computation was successful. | |
const LUMatrixType & | matrixL () const |
const LUMatrixType & | matrixU () const |
const IntColVectorType & | permutationP () const |
const IntRowVectorType & | permutationQ () const |
Index | rows () const |
template<typename Rhs > | |
const internal::solve_retval < UmfPackLU, Rhs > | solve (const MatrixBase< Rhs > &b) const |
UmfPackLU () | |
UmfPackLU (const MatrixType &matrix) | |
~UmfPackLU () | |
Protected Member Functions | |
void | grapInput (const MatrixType &mat) |
void | init () |
Protected Attributes | |
int | m_analysisIsOk |
UmfpackMatrixType | m_copyMatrix |
bool | m_extractedDataAreDirty |
int | m_factorizationIsOk |
ComputationInfo | m_info |
const int * | m_innerIndexPtr |
bool | m_isInitialized |
LUMatrixType | m_l |
void * | m_numeric |
const int * | m_outerIndexPtr |
IntColVectorType | m_p |
IntRowVectorType | m_q |
void * | m_symbolic |
LUMatrixType | m_u |
const Scalar * | m_valuePtr |
A sparse LU factorization and solver based on UmfPack.
This class allows to solve for A.X = B sparse linear problems via a LU factorization using the UmfPack library. The sparse matrix A must be squared and full rank. The vectors or matrices X and B can be either dense or sparse.
The input matrix A should be in a compressed and column-major form. Otherwise an expensive copy will be made. You can call the inexpensive makeCompressed() to get a compressed matrix.
_MatrixType | the type of the sparse matrix A, it must be a SparseMatrix<> |
typedef MatrixType::Index Index |
typedef Matrix<int, MatrixType::RowsAtCompileTime, 1> IntColVectorType |
typedef Matrix<int, 1, MatrixType::ColsAtCompileTime> IntRowVectorType |
typedef SparseMatrix<Scalar> LUMatrixType |
typedef _MatrixType MatrixType |
typedef MatrixType::RealScalar RealScalar |
typedef MatrixType::Scalar Scalar |
typedef SparseMatrix<Scalar,ColMajor,int> UmfpackMatrixType |
UmfPackLU | ( | ) | [inline] |
References UmfPackLU< _MatrixType >::init().
UmfPackLU | ( | const MatrixType & | matrix | ) | [inline] |
References UmfPackLU< _MatrixType >::compute(), and UmfPackLU< _MatrixType >::init().
~UmfPackLU | ( | ) | [inline] |
void analyzePattern | ( | const MatrixType & | matrix | ) | [inline] |
This function is particularly useful when solving for several problems having the same structure.
References UmfPackLU< _MatrixType >::grapInput(), Eigen::InvalidInput, UmfPackLU< _MatrixType >::m_analysisIsOk, UmfPackLU< _MatrixType >::m_factorizationIsOk, UmfPackLU< _MatrixType >::m_info, UmfPackLU< _MatrixType >::m_innerIndexPtr, UmfPackLU< _MatrixType >::m_isInitialized, UmfPackLU< _MatrixType >::m_numeric, UmfPackLU< _MatrixType >::m_outerIndexPtr, UmfPackLU< _MatrixType >::m_symbolic, UmfPackLU< _MatrixType >::m_valuePtr, Eigen::Success, Eigen::umfpack_free_numeric(), Eigen::umfpack_free_symbolic(), and Eigen::umfpack_symbolic().
Referenced by UmfPackLU< _MatrixType >::compute().
void compute | ( | const MatrixType & | matrix | ) | [inline] |
Computes the sparse Cholesky decomposition of matrix Note that the matrix should be column-major, and in compressed format for best performance.
References UmfPackLU< _MatrixType >::analyzePattern(), and UmfPackLU< _MatrixType >::factorize().
Referenced by UmfPackLU< _MatrixType >::UmfPackLU().
UmfPackLU< MatrixType >::Scalar determinant | ( | ) | const |
References Eigen::umfpack_get_determinant().
void extractData | ( | ) | const |
void factorize | ( | const MatrixType & | matrix | ) | [inline] |
Performs a numeric decomposition of matrix
The given matrix must has the same sparcity than the matrix on which the pattern anylysis has been performed.
References UmfPackLU< _MatrixType >::grapInput(), UmfPackLU< _MatrixType >::m_analysisIsOk, UmfPackLU< _MatrixType >::m_factorizationIsOk, UmfPackLU< _MatrixType >::m_info, UmfPackLU< _MatrixType >::m_innerIndexPtr, UmfPackLU< _MatrixType >::m_numeric, UmfPackLU< _MatrixType >::m_outerIndexPtr, UmfPackLU< _MatrixType >::m_symbolic, UmfPackLU< _MatrixType >::m_valuePtr, Eigen::NumericalIssue, Eigen::Success, Eigen::umfpack_free_numeric(), and Eigen::umfpack_numeric().
Referenced by UmfPackLU< _MatrixType >::compute().
void grapInput | ( | const MatrixType & | mat | ) | [inline, protected] |
References SparseMatrix< _Scalar, _Options, _Index >::innerIndexPtr(), UmfPackLU< _MatrixType >::m_copyMatrix, UmfPackLU< _MatrixType >::m_innerIndexPtr, UmfPackLU< _MatrixType >::m_outerIndexPtr, UmfPackLU< _MatrixType >::m_valuePtr, SparseMatrix< _Scalar, _Options, _Index >::outerIndexPtr(), SparseMatrix< _Scalar, _Options, _Index >::resize(), Eigen::RowMajorBit, and SparseMatrix< _Scalar, _Options, _Index >::valuePtr().
Referenced by UmfPackLU< _MatrixType >::analyzePattern(), and UmfPackLU< _MatrixType >::factorize().
ComputationInfo info | ( | ) | const [inline] |
Reports whether previous computation was successful.
Success
if computation was succesful, NumericalIssue
if the matrix.appears to be negative. References UmfPackLU< _MatrixType >::m_info, and UmfPackLU< _MatrixType >::m_isInitialized.
void init | ( | ) | [inline, protected] |
References Eigen::InvalidInput, UmfPackLU< _MatrixType >::m_info, UmfPackLU< _MatrixType >::m_innerIndexPtr, UmfPackLU< _MatrixType >::m_isInitialized, UmfPackLU< _MatrixType >::m_numeric, UmfPackLU< _MatrixType >::m_outerIndexPtr, UmfPackLU< _MatrixType >::m_symbolic, and UmfPackLU< _MatrixType >::m_valuePtr.
Referenced by UmfPackLU< _MatrixType >::UmfPackLU().
const LUMatrixType& matrixL | ( | ) | const [inline] |
const LUMatrixType& matrixU | ( | ) | const [inline] |
const IntColVectorType& permutationP | ( | ) | const [inline] |
const IntRowVectorType& permutationQ | ( | ) | const [inline] |
References UmfPackLU< _MatrixType >::m_copyMatrix, and SparseMatrix< _Scalar, _Options, _Index >::rows().
Referenced by UmfPackLU< _MatrixType >::solve().
const internal::solve_retval<UmfPackLU, Rhs> solve | ( | const MatrixBase< Rhs > & | b | ) | const [inline] |
References UmfPackLU< _MatrixType >::m_isInitialized, and UmfPackLU< _MatrixType >::rows().
int m_analysisIsOk [protected] |
Referenced by UmfPackLU< _MatrixType >::analyzePattern(), and UmfPackLU< _MatrixType >::factorize().
UmfpackMatrixType m_copyMatrix [protected] |
bool m_extractedDataAreDirty [mutable, protected] |
int m_factorizationIsOk [protected] |
Referenced by UmfPackLU< _MatrixType >::analyzePattern(), and UmfPackLU< _MatrixType >::factorize().
ComputationInfo m_info [mutable, protected] |
const int* m_innerIndexPtr [protected] |
bool m_isInitialized [protected] |
LUMatrixType m_l [mutable, protected] |
Referenced by UmfPackLU< _MatrixType >::matrixL().
void* m_numeric [protected] |
const int* m_outerIndexPtr [protected] |
IntColVectorType m_p [mutable, protected] |
Referenced by UmfPackLU< _MatrixType >::permutationP().
IntRowVectorType m_q [mutable, protected] |
Referenced by UmfPackLU< _MatrixType >::permutationQ().
void* m_symbolic [protected] |
LUMatrixType m_u [mutable, protected] |
Referenced by UmfPackLU< _MatrixType >::matrixU().
const Scalar* m_valuePtr [protected] |