Eigen::PardisoImpl< Derived > Class Template Reference

#include <PardisoSupport.h>

+ Inheritance diagram for Eigen::PardisoImpl< Derived >:

Public Types

enum  { ScalarIsComplex = NumTraits<Scalar>::IsComplex , ColsAtCompileTime = Dynamic , MaxColsAtCompileTime = Dynamic }
 
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, DontAlignParameterType
 

Public Member Functions

 PardisoImpl ()
 
 ~PardisoImpl ()
 
Index cols () const
 
Index rows () const
 
ComputationInfo info () const
 Reports whether previous computation was successful. More...
 
ParameterTypepardisoParameterArray ()
 
Derived & analyzePattern (const MatrixType &matrix)
 
Derived & factorize (const MatrixType &matrix)
 
Derived & compute (const MatrixType &matrix)
 
template<typename Rhs , typename Dest >
void _solve_impl (const MatrixBase< Rhs > &b, MatrixBase< Dest > &dest) const
 
template<typename BDerived , typename XDerived >
void _solve_impl (const MatrixBase< BDerived > &b, MatrixBase< XDerived > &x) const
 
template<typename Rhs , typename Dest >
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 SparseSolverBase< Derived > Base
 
typedef internal::pardiso_traits< Derived > Traits
 

Protected Member Functions

void pardisoRelease ()
 
void pardisoInit (int type)
 
void manageErrorCode (Index error) const
 
Derived & derived ()
 
const Derived & derived () const
 

Protected Attributes

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
 

Member Typedef Documentation

◆ Base

template<class Derived >
typedef SparseSolverBase<Derived> Eigen::PardisoImpl< Derived >::Base
protected

◆ IntColVectorType

template<class Derived >
typedef Matrix<StorageIndex, MatrixType::RowsAtCompileTime, 1> Eigen::PardisoImpl< Derived >::IntColVectorType

◆ IntRowVectorType

template<class Derived >
typedef Matrix<StorageIndex, 1, MatrixType::ColsAtCompileTime> Eigen::PardisoImpl< Derived >::IntRowVectorType

◆ MatrixType

template<class Derived >
typedef Traits::MatrixType Eigen::PardisoImpl< Derived >::MatrixType

◆ ParameterType

template<class Derived >
typedef Array<StorageIndex, 64, 1, DontAlign> Eigen::PardisoImpl< Derived >::ParameterType

◆ RealScalar

template<class Derived >
typedef Traits::RealScalar Eigen::PardisoImpl< Derived >::RealScalar

◆ Scalar

template<class Derived >
typedef Traits::Scalar Eigen::PardisoImpl< Derived >::Scalar

◆ SparseMatrixType

template<class Derived >
typedef SparseMatrix<Scalar, RowMajor, StorageIndex> Eigen::PardisoImpl< Derived >::SparseMatrixType

◆ StorageIndex

template<class Derived >
typedef Traits::StorageIndex Eigen::PardisoImpl< Derived >::StorageIndex

◆ Traits

template<class Derived >
typedef internal::pardiso_traits<Derived> Eigen::PardisoImpl< Derived >::Traits
protected

◆ VectorType

template<class Derived >
typedef Matrix<Scalar, Dynamic, 1> Eigen::PardisoImpl< Derived >::VectorType

Member Enumeration Documentation

◆ anonymous enum

template<class Derived >
anonymous enum
Enumerator
ScalarIsComplex 
ColsAtCompileTime 
MaxColsAtCompileTime 
@ MaxColsAtCompileTime
Definition: PardisoSupport.h:120
@ ColsAtCompileTime
Definition: PardisoSupport.h:120
@ ScalarIsComplex
Definition: PardisoSupport.h:120
const int Dynamic
Definition: Constants.h:25
@ IsComplex
Definition: NumTraits.h:176

Constructor & Destructor Documentation

◆ PardisoImpl()

template<class Derived >
Eigen::PardisoImpl< Derived >::PardisoImpl ( )
inline
122  : m_analysisIsOk(false), m_factorizationIsOk(false) {
123  eigen_assert((sizeof(StorageIndex) >= sizeof(_INTEGER_t) && sizeof(StorageIndex) <= 8) &&
124  "Non-supported index type");
125  m_iparm.setZero();
126  m_msglvl = 0; // No output
127  m_isInitialized = false;
128  }
#define eigen_assert(x)
Definition: Macros.h:910
Traits::StorageIndex StorageIndex
Definition: PardisoSupport.h:114
StorageIndex m_msglvl
Definition: PardisoSupport.h:237
bool m_factorizationIsOk
Definition: PardisoSupport.h:236
bool m_isInitialized
Definition: SparseSolverBase.h:110
ParameterType m_iparm
Definition: PardisoSupport.h:239
bool m_analysisIsOk
Definition: PardisoSupport.h:236
EIGEN_DEVICE_FUNC Derived & setZero(Index size)
Definition: CwiseNullaryOp.h:569

References eigen_assert, Eigen::PardisoImpl< Derived >::m_iparm, Eigen::PardisoImpl< Derived >::m_isInitialized, Eigen::PardisoImpl< Derived >::m_msglvl, and Eigen::PlainObjectBase< Derived >::setZero().

◆ ~PardisoImpl()

template<class Derived >
Eigen::PardisoImpl< Derived >::~PardisoImpl ( )
inline
130 { pardisoRelease(); }
void pardisoRelease()
Definition: PardisoSupport.h:172

References Eigen::PardisoImpl< Derived >::pardisoRelease().

Member Function Documentation

◆ _solve_impl() [1/3]

template<class Derived >
template<typename BDerived , typename XDerived >
void Eigen::PardisoImpl< Derived >::_solve_impl ( const MatrixBase< BDerived > &  b,
MatrixBase< XDerived > &  x 
) const
304  {
305  if (m_iparm[0] == 0) // Factorization was not computed
306  {
308  return;
309  }
310 
311  // Index n = m_matrix.rows();
312  Index nrhs = Index(b.cols());
313  eigen_assert(m_size == b.rows());
314  eigen_assert(((MatrixBase<BDerived>::Flags & RowMajorBit) == 0 || nrhs == 1) &&
315  "Row-major right hand sides are not supported");
316  eigen_assert(((MatrixBase<XDerived>::Flags & RowMajorBit) == 0 || nrhs == 1) &&
317  "Row-major matrices of unknowns are not supported");
318  eigen_assert(((nrhs == 1) || b.outerStride() == b.rows()));
319 
320  // switch (transposed) {
321  // case SvNoTrans : m_iparm[11] = 0 ; break;
322  // case SvTranspose : m_iparm[11] = 2 ; break;
323  // case SvAdjoint : m_iparm[11] = 1 ; break;
324  // default:
325  // //std::cerr << "Eigen: transposition option \"" << transposed << "\" not supported by the PARDISO backend\n";
326  // m_iparm[11] = 0;
327  // }
328 
329  Scalar* rhs_ptr = const_cast<Scalar*>(b.derived().data());
330  Matrix<Scalar, Dynamic, Dynamic, ColMajor> tmp;
331 
332  // Pardiso cannot solve in-place
333  if (rhs_ptr == x.derived().data()) {
334  tmp = b;
335  rhs_ptr = tmp.data();
336  }
337 
338  Index error;
340  m_pt, 1, 1, m_type, 33, internal::convert_index<StorageIndex>(m_size), m_matrix.valuePtr(),
341  m_matrix.outerIndexPtr(), m_matrix.innerIndexPtr(), m_perm.data(), internal::convert_index<StorageIndex>(nrhs),
342  m_iparm.data(), m_msglvl, rhs_ptr, x.derived().data());
343 
345 }
Scalar * b
Definition: benchVecAdd.cpp:17
SCALAR Scalar
Definition: bench_gemm.cpp:45
@ Flags
Definition: DenseBase.h:161
StorageIndex m_type
Definition: PardisoSupport.h:237
void * m_pt[64]
Definition: PardisoSupport.h:238
IntColVectorType m_perm
Definition: PardisoSupport.h:240
SparseMatrixType m_matrix
Definition: PardisoSupport.h:234
Index m_size
Definition: PardisoSupport.h:241
ComputationInfo m_info
Definition: PardisoSupport.h:235
void manageErrorCode(Index error) const
Definition: PardisoSupport.h:220
constexpr EIGEN_DEVICE_FUNC const Scalar * data() const
Definition: PlainObjectBase.h:273
const Scalar * valuePtr() const
Definition: SparseMatrix.h:171
const StorageIndex * outerIndexPtr() const
Definition: SparseMatrix.h:189
const StorageIndex * innerIndexPtr() const
Definition: SparseMatrix.h:180
@ InvalidInput
Definition: Constants.h:447
const unsigned int RowMajorBit
Definition: Constants.h:70
Eigen::Matrix< Scalar, Dynamic, Dynamic, ColMajor > tmp
Definition: level3_impl.h:365
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
int error
Definition: calibrate.py:297
list x
Definition: plotDoE.py:28
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

References b, Eigen::PlainObjectBase< Derived >::data(), eigen_assert, calibrate::error, Eigen::InvalidInput, Eigen::RowMajorBit, Eigen::internal::pardiso_run_selector< IndexType >::run(), tmp, and plotDoE::x.

◆ _solve_impl() [2/3]

template<class Derived >
template<typename Rhs , typename Dest >
void Eigen::PardisoImpl< Derived >::_solve_impl ( const MatrixBase< Rhs > &  b,
MatrixBase< Dest > &  dest 
) const

◆ _solve_impl() [3/3]

template<class Derived >
template<typename Rhs , typename Dest >
void Eigen::SparseSolverBase< Derived >::_solve_impl ( typename Rhs  ,
typename Dest   
)
inline

default implementation of solving with a sparse rhs

104  {
105  internal::solve_sparse_through_dense_panels(derived(), b.derived(), dest.derived());
106  }
Derived & derived()
Definition: SparseSolverBase.h:76
std::enable_if_t< Rhs::ColsAtCompileTime !=1 &&Dest::ColsAtCompileTime !=1 > solve_sparse_through_dense_panels(const Decomposition &dec, const Rhs &rhs, Dest &dest)
Definition: SparseSolverBase.h:25

◆ analyzePattern()

template<class Derived >
Derived & Eigen::PardisoImpl< Derived >::analyzePattern ( const MatrixType matrix)

Performs a symbolic decomposition on the sparcity of matrix.

This function is particularly useful when solving for several problems having the same structure.

See also
factorize()
265  {
266  m_size = a.rows();
267  eigen_assert(m_size == a.cols());
268 
269  pardisoRelease();
271  derived().getMatrix(a);
272 
273  Index error;
275  m_pt, 1, 1, m_type, 11, internal::convert_index<StorageIndex>(m_size), m_matrix.valuePtr(),
277 
280  m_factorizationIsOk = false;
281  m_isInitialized = true;
282  return derived();
283 }
@ Success
Definition: Constants.h:440
const Scalar * a
Definition: level2_cplx_impl.h:32

References a, eigen_assert, calibrate::error, Eigen::internal::pardiso_run_selector< IndexType >::run(), and Eigen::Success.

◆ cols()

◆ compute()

template<class Derived >
Derived & Eigen::PardisoImpl< Derived >::compute ( const MatrixType matrix)
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 }

References a, eigen_assert, calibrate::error, Eigen::internal::pardiso_run_selector< IndexType >::run(), and Eigen::Success.

◆ derived() [1/2]

template<class Derived >
Derived& Eigen::SparseSolverBase< Derived >::derived
inlineprotected
76 { return *static_cast<Derived*>(this); }

◆ derived() [2/2]

template<class Derived >
const Derived& Eigen::SparseSolverBase< Derived >::derived
inlineprotected
77 { return *static_cast<const Derived*>(this); }

◆ factorize()

template<class Derived >
Derived & Eigen::PardisoImpl< Derived >::factorize ( const MatrixType matrix)

Performs a numeric decomposition of matrix

The given matrix must has the same sparcity than the matrix on which the symbolic decomposition has been performed.

See also
analyzePattern()
286  {
287  eigen_assert(m_analysisIsOk && "You must first call analyzePattern()");
288  eigen_assert(m_size == a.rows() && m_size == a.cols());
289 
290  derived().getMatrix(a);
291 
292  Index error;
294  m_pt, 1, 1, m_type, 22, internal::convert_index<StorageIndex>(m_size), m_matrix.valuePtr(),
296 
299  return derived();
300 }

References a, eigen_assert, calibrate::error, Eigen::internal::pardiso_run_selector< IndexType >::run(), and Eigen::Success.

◆ info()

template<class Derived >
ComputationInfo Eigen::PardisoImpl< Derived >::info ( ) const
inline

Reports whether previous computation was successful.

Returns
Success if computation was successful, NumericalIssue if the matrix appears to be negative.
140  {
141  eigen_assert(m_isInitialized && "Decomposition is not initialized.");
142  return m_info;
143  }

References eigen_assert, Eigen::PardisoImpl< Derived >::m_info, and Eigen::PardisoImpl< Derived >::m_isInitialized.

◆ manageErrorCode()

template<class Derived >
void Eigen::PardisoImpl< Derived >::manageErrorCode ( Index  error) const
inlineprotected
220  {
221  switch (error) {
222  case 0:
223  m_info = Success;
224  break;
225  case -4:
226  case -7:
228  break;
229  default:
231  }
232  }
@ NumericalIssue
Definition: Constants.h:442

References calibrate::error, Eigen::InvalidInput, Eigen::PardisoImpl< Derived >::m_info, Eigen::NumericalIssue, and Eigen::Success.

◆ pardisoInit()

template<class Derived >
void Eigen::PardisoImpl< Derived >::pardisoInit ( int  type)
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
Traits::RealScalar RealScalar
Definition: PardisoSupport.h:113
type
Definition: compute_granudrum_aor.py:141

References abs(), Eigen::PardisoImpl< Derived >::m_iparm, Eigen::PardisoImpl< Derived >::m_pt, Eigen::PardisoImpl< Derived >::m_type, and compute_granudrum_aor::type.

◆ pardisoParameterArray()

template<class Derived >
ParameterType& Eigen::PardisoImpl< Derived >::pardisoParameterArray ( )
inline
Warning
for advanced usage only.
Returns
a reference to the parameter array controlling PARDISO. See the PARDISO manual to know how to use it.
148 { return m_iparm; }

References Eigen::PardisoImpl< Derived >::m_iparm.

◆ pardisoRelease()

◆ rows()

Member Data Documentation

◆ m_analysisIsOk

template<class Derived >
bool Eigen::PardisoImpl< Derived >::m_analysisIsOk
protected

◆ m_factorizationIsOk

template<class Derived >
bool Eigen::PardisoImpl< Derived >::m_factorizationIsOk
protected

◆ m_info

template<class Derived >
ComputationInfo Eigen::PardisoImpl< Derived >::m_info
mutableprotected

◆ m_iparm

◆ m_isInitialized

◆ m_matrix

template<class Derived >
SparseMatrixType Eigen::PardisoImpl< Derived >::m_matrix
mutableprotected

◆ m_msglvl

template<class Derived >
StorageIndex Eigen::PardisoImpl< Derived >::m_msglvl
protected

◆ m_perm

template<class Derived >
IntColVectorType Eigen::PardisoImpl< Derived >::m_perm
mutableprotected

◆ m_pt

template<class Derived >
void* Eigen::PardisoImpl< Derived >::m_pt[64]
mutableprotected

◆ m_size

◆ m_type


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