Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Eigen::PardisoImpl< Derived > Class Template Reference

#include <src/eigen/Eigen/src/PardisoSupport/PardisoSupport.h>

+ Inheritance diagram for Eigen::PardisoImpl< Derived >:
+ Collaboration 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.
 
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
 
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
 

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
 
voidm_pt [64]
 
ParameterType m_iparm
 
IntColVectorType m_perm
 
Index m_size
 
bool m_isInitialized
 

Detailed Description

template<class Derived>
class Eigen::PardisoImpl< Derived >

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 
119 {
120 ScalarIsComplex = NumTraits<Scalar>::IsComplex,
123 };
@ MaxColsAtCompileTime
Definition PardisoSupport.h:122
@ ColsAtCompileTime
Definition PardisoSupport.h:121
@ ScalarIsComplex
Definition PardisoSupport.h:120
const int Dynamic
Definition Constants.h:21

Constructor & Destructor Documentation

◆ PardisoImpl()

template<class Derived >
Eigen::PardisoImpl< Derived >::PardisoImpl ( )
inline
126 {
127 eigen_assert((sizeof(StorageIndex) >= sizeof(_INTEGER_t) && sizeof(StorageIndex) <= 8) && "Non-supported index type");
129 m_msglvl = 0; // No output
130 m_isInitialized = false;
131 }
#define eigen_assert(x)
Definition Macros.h:579
Traits::StorageIndex StorageIndex
Definition PardisoSupport.h:113
StorageIndex m_msglvl
Definition PardisoSupport.h:250
bool m_isInitialized
Definition SparseSolverBase.h:119
ParameterType m_iparm
Definition PardisoSupport.h:252
EIGEN_DEVICE_FUNC Derived & setZero(Index size)
Definition CwiseNullaryOp.h:515

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

+ Here is the call graph for this function:

◆ ~PardisoImpl()

template<class Derived >
Eigen::PardisoImpl< Derived >::~PardisoImpl ( )
inline
134 {
136 }
void pardisoRelease()
Definition PardisoSupport.h:182

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

+ Here is the call graph for this function:

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
322{
323 if(m_iparm[0] == 0) // Factorization was not computed
324 {
326 return;
327 }
328
329 //Index n = m_matrix.rows();
330 Index nrhs = Index(b.cols());
331 eigen_assert(m_size==b.rows());
332 eigen_assert(((MatrixBase<BDerived>::Flags & RowMajorBit) == 0 || nrhs == 1) && "Row-major right hand sides are not supported");
333 eigen_assert(((MatrixBase<XDerived>::Flags & RowMajorBit) == 0 || nrhs == 1) && "Row-major matrices of unknowns are not supported");
334 eigen_assert(((nrhs == 1) || b.outerStride() == b.rows()));
335
336
337// switch (transposed) {
338// case SvNoTrans : m_iparm[11] = 0 ; break;
339// case SvTranspose : m_iparm[11] = 2 ; break;
340// case SvAdjoint : m_iparm[11] = 1 ; break;
341// default:
342// //std::cerr << "Eigen: transposition option \"" << transposed << "\" not supported by the PARDISO backend\n";
343// m_iparm[11] = 0;
344// }
345
346 Scalar* rhs_ptr = const_cast<Scalar*>(b.derived().data());
347 Matrix<Scalar,Dynamic,Dynamic,ColMajor> tmp;
348
349 // Pardiso cannot solve in-place
350 if(rhs_ptr == x.derived().data())
351 {
352 tmp = b;
353 rhs_ptr = tmp.data();
354 }
355
356 Index error;
357 error = internal::pardiso_run_selector<StorageIndex>::run(m_pt, 1, 1, m_type, 33, internal::convert_index<StorageIndex>(m_size),
359 m_perm.data(), internal::convert_index<StorageIndex>(nrhs), m_iparm.data(), m_msglvl,
360 rhs_ptr, x.derived().data());
361
363}
@ Flags
Definition DenseBase.h:160
StorageIndex m_type
Definition PardisoSupport.h:250
void * m_pt[64]
Definition PardisoSupport.h:251
IntColVectorType m_perm
Definition PardisoSupport.h:253
SparseMatrixType m_matrix
Definition PardisoSupport.h:247
Index m_size
Definition PardisoSupport.h:254
ComputationInfo m_info
Definition PardisoSupport.h:248
void manageErrorCode(Index error) const
Definition PardisoSupport.h:231
Traits::Scalar Scalar
Definition PardisoSupport.h:111
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar * data() const
Definition PlainObjectBase.h:255
const StorageIndex * innerIndexPtr() const
Definition SparseMatrix.h:157
const StorageIndex * outerIndexPtr() const
Definition SparseMatrix.h:166
const Scalar * valuePtr() const
Definition SparseMatrix.h:148
@ InvalidInput
Definition Constants.h:439
const unsigned int RowMajorBit
Definition Constants.h:61
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:33
TCoord< P > x(const P &p)
Definition geometry_traits.hpp: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:46
static char error[256]
Definition tga.cpp:50

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

+ Here is the call graph for this function:

◆ _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 ( const SparseMatrixBase< Rhs > &  b,
SparseMatrixBase< Dest > &  dest 
) const
inline
112 {
113 internal::solve_sparse_through_dense_panels(derived(), b.derived(), dest.derived());
114 }
Derived & derived()
Definition SparseSolverBase.h:79
enable_if< Rhs::ColsAtCompileTime!=1 &&Dest::ColsAtCompileTime!=1 >::type solve_sparse_through_dense_panels(const Decomposition &dec, const Rhs &rhs, Dest &dest)
Definition SparseSolverBase.h:23

◆ 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()
281{
282 m_size = a.rows();
283 eigen_assert(m_size == a.cols());
284
287 derived().getMatrix(a);
288
289 Index error;
290 error = internal::pardiso_run_selector<StorageIndex>::run(m_pt, 1, 1, m_type, 11, internal::convert_index<StorageIndex>(m_size),
292 m_perm.data(), 0, m_iparm.data(), m_msglvl, NULL, NULL);
293
295 m_analysisIsOk = true;
296 m_factorizationIsOk = false;
297 m_isInitialized = true;
298 return derived();
299}
bool m_factorizationIsOk
Definition PardisoSupport.h:249
bool m_analysisIsOk
Definition PardisoSupport.h:249

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

+ Here is the call graph for this function:

◆ cols()

template<class Derived >
Index Eigen::PardisoImpl< Derived >::cols ( ) const
inline
138{ return m_size; }

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

◆ compute()

template<class Derived >
Derived & Eigen::PardisoImpl< Derived >::compute ( const MatrixType matrix)
260{
261 m_size = a.rows();
262 eigen_assert(a.rows() == a.cols());
263
266 derived().getMatrix(a);
267
268 Index error;
269 error = internal::pardiso_run_selector<StorageIndex>::run(m_pt, 1, 1, m_type, 12, internal::convert_index<StorageIndex>(m_size),
271 m_perm.data(), 0, m_iparm.data(), m_msglvl, NULL, NULL);
273 m_analysisIsOk = true;
274 m_factorizationIsOk = true;
275 m_isInitialized = true;
276 return derived();
277}

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

+ Here is the call graph for this function:

◆ derived() [1/2]

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

◆ derived() [2/2]

template<class Derived >
const Derived & Eigen::SparseSolverBase< Derived >::derived ( ) const
inlineprotected
80{ 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()
303{
304 eigen_assert(m_analysisIsOk && "You must first call analyzePattern()");
305 eigen_assert(m_size == a.rows() && m_size == a.cols());
306
307 derived().getMatrix(a);
308
309 Index error;
310 error = internal::pardiso_run_selector<StorageIndex>::run(m_pt, 1, 1, m_type, 22, internal::convert_index<StorageIndex>(m_size),
312 m_perm.data(), 0, m_iparm.data(), m_msglvl, NULL, NULL);
313
315 m_factorizationIsOk = true;
316 return derived();
317}

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

+ Here is the call graph for this function:

◆ info()

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

Reports whether previous computation was successful.

Returns
Success if computation was succesful, NumericalIssue if the matrix appears to be negative.
147 {
148 eigen_assert(m_isInitialized && "Decomposition is not initialized.");
149 return m_info;
150 }

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
232 {
233 switch(error)
234 {
235 case 0:
236 m_info = Success;
237 break;
238 case -4:
239 case -7:
241 break;
242 default:
244 }
245 }
@ NumericalIssue
Definition Constants.h:434
@ Success
Definition Constants.h:432

References 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
193 {
194 m_type = type;
195 bool symmetric = std::abs(m_type) < 10;
196 m_iparm[0] = 1; // No solver default
197 m_iparm[1] = 2; // use Metis for the ordering
198 m_iparm[2] = 0; // Reserved. Set to zero. (??Numbers of processors, value of OMP_NUM_THREADS??)
199 m_iparm[3] = 0; // No iterative-direct algorithm
200 m_iparm[4] = 0; // No user fill-in reducing permutation
201 m_iparm[5] = 0; // Write solution into x, b is left unchanged
202 m_iparm[6] = 0; // Not in use
203 m_iparm[7] = 2; // Max numbers of iterative refinement steps
204 m_iparm[8] = 0; // Not in use
205 m_iparm[9] = 13; // Perturb the pivot elements with 1E-13
206 m_iparm[10] = symmetric ? 0 : 1; // Use nonsymmetric permutation and scaling MPS
207 m_iparm[11] = 0; // Not in use
208 m_iparm[12] = symmetric ? 0 : 1; // Maximum weighted matching algorithm is switched-off (default for symmetric).
209 // Try m_iparm[12] = 1 in case of inappropriate accuracy
210 m_iparm[13] = 0; // Output: Number of perturbed pivots
211 m_iparm[14] = 0; // Not in use
212 m_iparm[15] = 0; // Not in use
213 m_iparm[16] = 0; // Not in use
214 m_iparm[17] = -1; // Output: Number of nonzeros in the factor LU
215 m_iparm[18] = -1; // Output: Mflops for LU factorization
216 m_iparm[19] = 0; // Output: Numbers of CG Iterations
217
218 m_iparm[20] = 0; // 1x1 pivoting
219 m_iparm[26] = 0; // No matrix checker
220 m_iparm[27] = (sizeof(RealScalar) == 4) ? 1 : 0;
221 m_iparm[34] = 1; // C indexing
222 m_iparm[36] = 0; // CSR
223 m_iparm[59] = 0; // 0 - In-Core ; 1 - Automatic switch between In-Core and Out-of-Core modes ; 2 - Out-of-Core
224
225 memset(m_pt, 0, sizeof(m_pt));
226 }
Traits::RealScalar RealScalar
Definition PardisoSupport.h:112

References Eigen::PardisoImpl< Derived >::m_iparm, Eigen::PardisoImpl< Derived >::m_pt, and Eigen::PardisoImpl< Derived >::m_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.
156 {
157 return m_iparm;
158 }

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

◆ pardisoRelease()

template<class Derived >
void Eigen::PardisoImpl< Derived >::pardisoRelease ( )
inlineprotected
183 {
184 if(m_isInitialized) // Factorization ran at least once
185 {
186 internal::pardiso_run_selector<StorageIndex>::run(m_pt, 1, 1, m_type, -1, internal::convert_index<StorageIndex>(m_size),0, 0, 0, m_perm.data(), 0,
187 m_iparm.data(), m_msglvl, NULL, NULL);
188 m_isInitialized = false;
189 }
190 }

References Eigen::PlainObjectBase< Derived >::data(), Eigen::PardisoImpl< Derived >::m_iparm, Eigen::PardisoImpl< Derived >::m_isInitialized, Eigen::PardisoImpl< Derived >::m_msglvl, Eigen::PardisoImpl< Derived >::m_perm, Eigen::PardisoImpl< Derived >::m_pt, Eigen::PardisoImpl< Derived >::m_size, Eigen::PardisoImpl< Derived >::m_type, and Eigen::internal::pardiso_run_selector< IndexType >::run().

Referenced by Eigen::PardisoImpl< Derived >::~PardisoImpl().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rows()

template<class Derived >
Index Eigen::PardisoImpl< Derived >::rows ( ) const
inline
139{ return m_size; }

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

◆ solve() [1/2]

template<typename Derived >
template<typename Rhs >
const Solve< Derived, Rhs > Eigen::SparseSolverBase< Derived >::solve ( const MatrixBase< Rhs > &  b) const
inlineinherited
Returns
an expression of the solution x of $ A x = b $ using the current decomposition of A.
See also
compute()
89 {
90 eigen_assert(m_isInitialized && "Solver is not initialized.");
91 eigen_assert(derived().rows()==b.rows() && "solve(): invalid number of rows of the right hand side matrix b");
92 return Solve<Derived, Rhs>(derived(), b.derived());
93 }
bool m_isInitialized
Definition SparseSolverBase.h:119
Derived & derived()
Definition SparseSolverBase.h:79
size_t rows(const T &raster)
Definition MarchingSquares.hpp:55

References Eigen::SparseSolverBase< Derived >::derived(), eigen_assert, and Eigen::SparseSolverBase< Derived >::m_isInitialized.

Referenced by igl::embree::bone_heat(), igl::Frame_field_deformer::compute_optimal_positions(), igl::eigs(), igl::copyleft::comiso::FrameInterpolator::interpolateSymmetric(), igl::slim::solve_weighted_arap(), and igl::copyleft::comiso::NRosyField::solveNoRoundings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ solve() [2/2]

template<typename Derived >
template<typename Rhs >
const Solve< Derived, Rhs > Eigen::SparseSolverBase< Derived >::solve ( const SparseMatrixBase< Rhs > &  b) const
inlineinherited
Returns
an expression of the solution x of $ A x = b $ using the current decomposition of A.
See also
compute()
102 {
103 eigen_assert(m_isInitialized && "Solver is not initialized.");
104 eigen_assert(derived().rows()==b.rows() && "solve(): invalid number of rows of the right hand side matrix b");
105 return Solve<Derived, Rhs>(derived(), b.derived());
106 }

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

template<class Derived >
bool Eigen::SparseSolverBase< Derived >::m_isInitialized
mutableprotected

◆ 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: