Eigen::PardisoLU< MatrixType > Class Template Reference

A sparse direct LU factorization and solver based on the PARDISO library. More...

#include <PardisoSupport.h>

+ Inheritance diagram for Eigen::PardisoLU< MatrixType >:

Public Types

typedef Base::Scalar Scalar
 
typedef Base::RealScalar RealScalar
 
- Public Types inherited from Eigen::PardisoImpl< PardisoLU< MatrixType > >
enum  
 
typedef Traits::MatrixType MatrixType
 
typedef Traits::Scalar Scalar
 
typedef Traits::RealScalar RealScalar
 
typedef Traits::StorageIndex StorageIndex
 
typedef SparseMatrix< Scalar, RowMajor, StorageIndexSparseMatrixType
 
typedef Matrix< Scalar, Dynamic, 1 > VectorType
 
typedef Matrix< StorageIndex, 1, MatrixType::ColsAtCompileTime > IntRowVectorType
 
typedef Matrix< StorageIndex, MatrixType::RowsAtCompileTime, 1 > IntColVectorType
 
typedef Array< StorageIndex, 64, 1, DontAlign > ParameterType
 

Public Member Functions

 PardisoLU ()
 
 PardisoLU (const MatrixType &matrix)
 
Derived & compute (const MatrixType &matrix)
 
- Public Member Functions inherited from Eigen::PardisoImpl< PardisoLU< MatrixType > >
 PardisoImpl ()
 
 ~PardisoImpl ()
 
Index cols () const
 
Index rows () const
 
ComputationInfo info () const
 Reports whether previous computation was successful. More...
 
ParameterTypepardisoParameterArray ()
 
PardisoLU< MatrixType > & analyzePattern (const MatrixType &matrix)
 
PardisoLU< MatrixType > & factorize (const MatrixType &matrix)
 
PardisoLU< MatrixType > & compute (const MatrixType &matrix)
 
void _solve_impl (const MatrixBase< Rhs > &b, MatrixBase< Dest > &dest) const
 
void _solve_impl (const MatrixBase< BDerived > &b, MatrixBase< XDerived > &x) const
 
void _solve_impl (const SparseMatrixBase< Rhs > &b, SparseMatrixBase< Dest > &dest) const
 
- Public Member Functions inherited from Eigen::SparseSolverBase< Derived >
 SparseSolverBase ()
 
 SparseSolverBase (SparseSolverBase &&other)
 
 ~SparseSolverBase ()
 
Derived & derived ()
 
const Derived & derived () const
 
template<typename Rhs >
const Solve< Derived, Rhs > solve (const MatrixBase< Rhs > &b) const
 
template<typename Rhs >
const Solve< Derived, Rhs > solve (const SparseMatrixBase< Rhs > &b) const
 
template<typename Rhs , typename Dest >
void _solve_impl (const SparseMatrixBase< Rhs > &b, SparseMatrixBase< Dest > &dest) const
 

Protected Types

typedef PardisoImpl< PardisoLUBase
 
- Protected Types inherited from Eigen::PardisoImpl< PardisoLU< MatrixType > >
typedef SparseSolverBase< PardisoLU< MatrixType > > Base
 
typedef internal::pardiso_traits< PardisoLU< MatrixType > > Traits
 

Protected Member Functions

void getMatrix (const MatrixType &matrix)
 
void pardisoInit (int type)
 
- Protected Member Functions inherited from Eigen::PardisoImpl< PardisoLU< MatrixType > >
void pardisoRelease ()
 
void pardisoInit (int type)
 
void manageErrorCode (Index error) const
 
PardisoLU< MatrixType > & derived ()
 
const PardisoLU< MatrixType > & derived () const
 

Protected Attributes

SparseMatrixType m_matrix
 
- Protected Attributes inherited from Eigen::PardisoImpl< PardisoLU< MatrixType > >
SparseMatrixType m_matrix
 
ComputationInfo m_info
 
bool m_analysisIsOk
 
bool m_factorizationIsOk
 
StorageIndex m_type
 
StorageIndex m_msglvl
 
void * m_pt [64]
 
ParameterType m_iparm
 
IntColVectorType m_perm
 
Index m_size
 
bool m_isInitialized
 
- Protected Attributes inherited from Eigen::SparseSolverBase< Derived >
bool m_isInitialized
 

Friends

class PardisoImpl< PardisoLU< MatrixType > >
 

Detailed Description

template<typename MatrixType>
class Eigen::PardisoLU< MatrixType >

A sparse direct LU factorization and solver based on the PARDISO library.

This class allows to solve for A.X = B sparse linear problems via a direct LU factorization using the Intel MKL PARDISO library. The sparse matrix A must be squared and invertible. The vectors or matrices X and B can be either dense or sparse.

By default, it runs in in-core mode. To enable PARDISO's out-of-core feature, set:

solver.pardisoParameterArray()[59] = 1;
BiCGSTAB< SparseMatrix< double > > solver
Definition: BiCGSTAB_simple.cpp:5
Template Parameters
MatrixType_the type of the sparse matrix A, it must be a SparseMatrix<>

\implsparsesolverconcept

See also
Sparse solver concept, class SparseLU

Member Typedef Documentation

◆ Base

template<typename MatrixType >
typedef PardisoImpl<PardisoLU> Eigen::PardisoLU< MatrixType >::Base
protected

◆ RealScalar

template<typename MatrixType >
typedef Base::RealScalar Eigen::PardisoLU< MatrixType >::RealScalar

◆ Scalar

template<typename MatrixType >
typedef Base::Scalar Eigen::PardisoLU< MatrixType >::Scalar

Constructor & Destructor Documentation

◆ PardisoLU() [1/2]

template<typename MatrixType >
Eigen::PardisoLU< MatrixType >::PardisoLU ( )
inline
379 : Base() { pardisoInit(Base::ScalarIsComplex ? 13 : 11); }
@ ScalarIsComplex
Definition: PardisoSupport.h:120
void pardisoInit(int type)
Definition: PardisoSupport.h:182
PardisoImpl< PardisoLU > Base
Definition: PardisoSupport.h:367

References Eigen::PardisoLU< MatrixType >::pardisoInit(), and Eigen::PardisoImpl< Derived >::ScalarIsComplex.

◆ PardisoLU() [2/2]

template<typename MatrixType >
Eigen::PardisoLU< MatrixType >::PardisoLU ( const MatrixType matrix)
inlineexplicit
381  : Base() {
383  compute(matrix);
384  }
Derived & compute(const MatrixType &matrix)
Definition: PardisoSupport.h:245
Eigen::Map< Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor >, 0, Eigen::OuterStride<> > matrix(T *data, int rows, int cols, int stride)
Definition: common.h:85

References Eigen::PardisoLU< MatrixType >::compute(), matrix(), Eigen::PardisoLU< MatrixType >::pardisoInit(), and Eigen::PardisoImpl< Derived >::ScalarIsComplex.

Member Function Documentation

◆ compute()

template<typename MatrixType >
Derived & Eigen::PardisoImpl< Derived >::compute
245  {
246  m_size = a.rows();
247  eigen_assert(a.rows() == a.cols());
248 
249  pardisoRelease();
251  derived().getMatrix(a);
252 
253  Index error;
255  m_pt, 1, 1, m_type, 12, internal::convert_index<StorageIndex>(m_size), m_matrix.valuePtr(),
260  m_isInitialized = true;
261  return derived();
262 }
#define eigen_assert(x)
Definition: Macros.h:910
StorageIndex m_type
Definition: PardisoSupport.h:237
void * m_pt[64]
Definition: PardisoSupport.h:238
IntColVectorType m_perm
Definition: PardisoSupport.h:240
Index m_size
Definition: PardisoSupport.h:241
StorageIndex m_msglvl
Definition: PardisoSupport.h:237
bool m_factorizationIsOk
Definition: PardisoSupport.h:236
ComputationInfo m_info
Definition: PardisoSupport.h:235
void pardisoRelease()
Definition: PardisoSupport.h:172
bool m_isInitialized
Definition: SparseSolverBase.h:110
PardisoLU< MatrixType > & derived()
Definition: SparseSolverBase.h:76
void manageErrorCode(Index error) const
Definition: PardisoSupport.h:220
ParameterType m_iparm
Definition: PardisoSupport.h:239
bool m_analysisIsOk
Definition: PardisoSupport.h:236
SparseMatrixType m_matrix
Definition: PardisoSupport.h:234
constexpr EIGEN_DEVICE_FUNC const Scalar * data() const
Definition: PlainObjectBase.h:273
EIGEN_DEVICE_FUNC Derived & setZero(Index size)
Definition: CwiseNullaryOp.h:569
const Scalar * valuePtr() const
Definition: SparseMatrix.h:171
const StorageIndex * outerIndexPtr() const
Definition: SparseMatrix.h:189
const StorageIndex * innerIndexPtr() const
Definition: SparseMatrix.h:180
@ Success
Definition: Constants.h:440
const Scalar * a
Definition: level2_cplx_impl.h:32
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
int error
Definition: calibrate.py:297
static IndexType run(_MKL_DSS_HANDLE_t pt, IndexType maxfct, IndexType mnum, IndexType type, IndexType phase, IndexType n, void *a, IndexType *ia, IndexType *ja, IndexType *perm, IndexType nrhs, IndexType *iparm, IndexType msglvl, void *b, void *x)
Definition: PardisoSupport.h:50

Referenced by Eigen::PardisoLU< MatrixType >::PardisoLU().

◆ getMatrix()

template<typename MatrixType >
void Eigen::PardisoLU< MatrixType >::getMatrix ( const MatrixType matrix)
inlineprotected

◆ pardisoInit()

template<typename MatrixType >
void Eigen::PardisoImpl< Derived >::pardisoInit
inlineprotected
182  {
183  m_type = type;
184  bool symmetric = std::abs(m_type) < 10;
185  m_iparm[0] = 1; // No solver default
186  m_iparm[1] = 2; // use Metis for the ordering
187  m_iparm[2] = 0; // Reserved. Set to zero. (??Numbers of processors, value of OMP_NUM_THREADS??)
188  m_iparm[3] = 0; // No iterative-direct algorithm
189  m_iparm[4] = 0; // No user fill-in reducing permutation
190  m_iparm[5] = 0; // Write solution into x, b is left unchanged
191  m_iparm[6] = 0; // Not in use
192  m_iparm[7] = 2; // Max numbers of iterative refinement steps
193  m_iparm[8] = 0; // Not in use
194  m_iparm[9] = 13; // Perturb the pivot elements with 1E-13
195  m_iparm[10] = symmetric ? 0 : 1; // Use nonsymmetric permutation and scaling MPS
196  m_iparm[11] = 0; // Not in use
197  m_iparm[12] = symmetric ? 0 : 1; // Maximum weighted matching algorithm is switched-off (default for symmetric).
198  // Try m_iparm[12] = 1 in case of inappropriate accuracy
199  m_iparm[13] = 0; // Output: Number of perturbed pivots
200  m_iparm[14] = 0; // Not in use
201  m_iparm[15] = 0; // Not in use
202  m_iparm[16] = 0; // Not in use
203  m_iparm[17] = -1; // Output: Number of nonzeros in the factor LU
204  m_iparm[18] = -1; // Output: Mflops for LU factorization
205  m_iparm[19] = 0; // Output: Numbers of CG Iterations
206 
207  m_iparm[20] = 0; // 1x1 pivoting
208  m_iparm[26] = 0; // No matrix checker
209  m_iparm[27] = (sizeof(RealScalar) == 4) ? 1 : 0;
210  m_iparm[34] = 1; // C indexing
211  m_iparm[36] = 0; // CSR
212  m_iparm[59] = 0; // 0 - In-Core ; 1 - Automatic switch between In-Core and Out-of-Core modes ; 2 - Out-of-Core
213 
214  memset(m_pt, 0, sizeof(m_pt));
215  }
AnnoyingScalar abs(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:135
Base::RealScalar RealScalar
Definition: PardisoSupport.h:374
type
Definition: compute_granudrum_aor.py:141

Referenced by Eigen::PardisoLU< MatrixType >::PardisoLU().

Friends And Related Function Documentation

◆ PardisoImpl< PardisoLU< MatrixType > >

template<typename MatrixType >
friend class PardisoImpl< PardisoLU< MatrixType > >
friend

Member Data Documentation

◆ m_matrix

template<typename MatrixType >
SparseMatrixType Eigen::PardisoImpl< Derived >::m_matrix
mutableprotected

The documentation for this class was generated from the following file: