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

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

+ Inheritance diagram for Eigen::PastixBase< Derived >:
+ Collaboration diagram for Eigen::PastixBase< Derived >:

Public Types

enum  { ColsAtCompileTime = MatrixType::ColsAtCompileTime , MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime }
 
typedef internal::pastix_traits< Derived >::MatrixType _MatrixType
 
typedef _MatrixType MatrixType
 
typedef MatrixType::Scalar Scalar
 
typedef MatrixType::RealScalar RealScalar
 
typedef MatrixType::StorageIndex StorageIndex
 
typedef Matrix< Scalar, Dynamic, 1 > Vector
 
typedef SparseMatrix< Scalar, ColMajorColSpMatrix
 

Public Member Functions

 PastixBase ()
 
 ~PastixBase ()
 
template<typename Rhs , typename Dest >
bool _solve_impl (const MatrixBase< Rhs > &b, MatrixBase< Dest > &x) const
 
Array< StorageIndex, IPARM_SIZE, 1 > & iparm ()
 
int & iparm (int idxparam)
 
Array< double, DPARM_SIZE, 1 > & dparm ()
 
double & dparm (int idxparam)
 
Index cols () const
 
Index rows () const
 
ComputationInfo info () const
 Reports whether previous computation was successful.
 
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
 

Protected Member Functions

void init ()
 
void analyzePattern (ColSpMatrix &mat)
 
void factorize (ColSpMatrix &mat)
 
void clean ()
 
void compute (ColSpMatrix &mat)
 
Derived & derived ()
 
const Derived & derived () const
 

Protected Attributes

int m_initisOk
 
int m_analysisIsOk
 
int m_factorizationIsOk
 
ComputationInfo m_info
 
pastix_data_t * m_pastixdata
 
int m_comm
 
Array< int, IPARM_SIZE, 1 > m_iparm
 
Array< double, DPARM_SIZE, 1 > m_dparm
 
Matrix< StorageIndex, Dynamic, 1 > m_perm
 
Matrix< StorageIndex, Dynamic, 1 > m_invp
 
int m_size
 
bool m_isInitialized
 

Detailed Description

template<class Derived>
class Eigen::PastixBase< Derived >

Member Typedef Documentation

◆ _MatrixType

template<class Derived >
typedef internal::pastix_traits<Derived>::MatrixType Eigen::PastixBase< Derived >::_MatrixType

◆ Base

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

◆ ColSpMatrix

template<class Derived >
typedef SparseMatrix<Scalar, ColMajor> Eigen::PastixBase< Derived >::ColSpMatrix

◆ MatrixType

template<class Derived >
typedef _MatrixType Eigen::PastixBase< Derived >::MatrixType

◆ RealScalar

template<class Derived >
typedef MatrixType::RealScalar Eigen::PastixBase< Derived >::RealScalar

◆ Scalar

template<class Derived >
typedef MatrixType::Scalar Eigen::PastixBase< Derived >::Scalar

◆ StorageIndex

template<class Derived >
typedef MatrixType::StorageIndex Eigen::PastixBase< Derived >::StorageIndex

◆ Vector

template<class Derived >
typedef Matrix<Scalar,Dynamic,1> Eigen::PastixBase< Derived >::Vector

Member Enumeration Documentation

◆ anonymous enum

template<class Derived >
anonymous enum
Enumerator
ColsAtCompileTime 
MaxColsAtCompileTime 
144 {
145 ColsAtCompileTime = MatrixType::ColsAtCompileTime,
146 MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime
147 };
@ ColsAtCompileTime
Definition PaStiXSupport.h:145
@ MaxColsAtCompileTime
Definition PaStiXSupport.h:146

Constructor & Destructor Documentation

◆ PastixBase()

template<class Derived >
Eigen::PastixBase< Derived >::PastixBase ( )
inline
151 : m_initisOk(false), m_analysisIsOk(false), m_factorizationIsOk(false), m_pastixdata(0), m_size(0)
152 {
153 init();
154 }
int m_factorizationIsOk
Definition PaStiXSupport.h:243
int m_analysisIsOk
Definition PaStiXSupport.h:242
int m_initisOk
Definition PaStiXSupport.h:241
int m_size
Definition PaStiXSupport.h:251
void init()
Definition PaStiXSupport.h:259
pastix_data_t * m_pastixdata
Definition PaStiXSupport.h:245

References Eigen::PastixBase< Derived >::init().

+ Here is the call graph for this function:

◆ ~PastixBase()

template<class Derived >
Eigen::PastixBase< Derived >::~PastixBase ( )
inline
157 {
158 clean();
159 }
void clean()
Definition PaStiXSupport.h:230

References Eigen::PastixBase< Derived >::clean().

+ Here is the call graph for this function:

Member Function Documentation

◆ _solve_impl() [1/2]

template<typename Base >
template<typename Rhs , typename Dest >
bool Eigen::PastixBase< Base >::_solve_impl ( const MatrixBase< Rhs > &  b,
MatrixBase< Dest > &  x 
) const
368{
369 eigen_assert(m_isInitialized && "The matrix should be factorized first");
370 EIGEN_STATIC_ASSERT((Dest::Flags&RowMajorBit)==0,
371 THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES);
372 int rhs = 1;
373
374 x = b; /* on return, x is overwritten by the computed solution */
375
376 for (int i = 0; i < b.cols(); i++){
377 m_iparm[IPARM_START_TASK] = API_TASK_SOLVE;
378 m_iparm[IPARM_END_TASK] = API_TASK_REFINE;
379
380 internal::eigen_pastix(&m_pastixdata, MPI_COMM_WORLD, internal::convert_index<int>(x.rows()), 0, 0, 0,
381 m_perm.data(), m_invp.data(), &x(0, i), rhs, m_iparm.data(), m_dparm.data());
382 }
383
384 // Check the returned error
385 m_info = m_iparm(IPARM_ERROR_NUMBER)==0 ? Success : NumericalIssue;
386
387 return m_iparm(IPARM_ERROR_NUMBER)==0;
388}
#define eigen_assert(x)
Definition Macros.h:579
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
Definition StaticAssert.h:124
Array< double, DPARM_SIZE, 1 > m_dparm
Definition PaStiXSupport.h:248
Matrix< StorageIndex, Dynamic, 1 > m_invp
Definition PaStiXSupport.h:250
Matrix< StorageIndex, Dynamic, 1 > m_perm
Definition PaStiXSupport.h:249
Array< int, IPARM_SIZE, 1 > m_iparm
Definition PaStiXSupport.h:247
bool m_isInitialized
Definition SparseSolverBase.h:119
ComputationInfo m_info
Definition PaStiXSupport.h:244
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar * data() const
Definition PlainObjectBase.h:255
@ NumericalIssue
Definition Constants.h:434
@ Success
Definition Constants.h:432
const unsigned int RowMajorBit
Definition Constants.h:61
void eigen_pastix(pastix_data_t **pastix_data, int pastix_comm, int n, int *ptr, int *idx, float *vals, int *perm, int *invp, float *x, int nbrhs, int *iparm, double *dparm)
Definition PaStiXSupport.h:67
TCoord< P > x(const P &p)
Definition geometry_traits.hpp:297

References eigen_assert, Eigen::internal::eigen_pastix(), EIGEN_STATIC_ASSERT, Eigen::NumericalIssue, Eigen::RowMajorBit, and Eigen::Success.

+ Here is the call graph for this function:

◆ _solve_impl() [2/2]

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 >
void Eigen::PastixBase< Derived >::analyzePattern ( ColSpMatrix mat)
protected
308{
309 eigen_assert(m_initisOk && "The initialization of PaSTiX failed");
310
311 // clean previous calls
312 if(m_size>0)
313 clean();
314
315 m_size = internal::convert_index<int>(mat.rows());
318
319 m_iparm(IPARM_START_TASK) = API_TASK_ORDERING;
320 m_iparm(IPARM_END_TASK) = API_TASK_ANALYSE;
321 internal::eigen_pastix(&m_pastixdata, MPI_COMM_WORLD, m_size, mat.outerIndexPtr(), mat.innerIndexPtr(),
322 mat.valuePtr(), m_perm.data(), m_invp.data(), 0, 0, m_iparm.data(), m_dparm.data());
323
324 // Check the returned error
325 if(m_iparm(IPARM_ERROR_NUMBER))
326 {
328 m_analysisIsOk = false;
329 }
330 else
331 {
332 m_info = Success;
333 m_analysisIsOk = true;
334 }
335}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resize(Index rows, Index cols)
Definition PlainObjectBase.h:279

References eigen_assert, Eigen::internal::eigen_pastix(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::innerIndexPtr(), Eigen::NumericalIssue, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::outerIndexPtr(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::rows(), Eigen::Success, and Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::valuePtr().

Referenced by Eigen::PastixLU< _MatrixType, IsStrSym >::analyzePattern(), Eigen::PastixLLT< _MatrixType, _UpLo >::analyzePattern(), and Eigen::PastixLDLT< _MatrixType, _UpLo >::analyzePattern().

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

◆ clean()

template<class Derived >
void Eigen::PastixBase< Derived >::clean ( )
inlineprotected
231 {
232 eigen_assert(m_initisOk && "The Pastix structure should be allocated first");
233 m_iparm(IPARM_START_TASK) = API_TASK_CLEAN;
234 m_iparm(IPARM_END_TASK) = API_TASK_CLEAN;
235 internal::eigen_pastix(&m_pastixdata, MPI_COMM_WORLD, 0, 0, 0, (Scalar*)0,
236 m_perm.data(), m_invp.data(), 0, 0, m_iparm.data(), m_dparm.data());
237 }
MatrixType::Scalar Scalar
Definition PaStiXSupport.h:139

References Eigen::PlainObjectBase< Derived >::data(), eigen_assert, Eigen::internal::eigen_pastix(), Eigen::PastixBase< Derived >::m_dparm, Eigen::PastixBase< Derived >::m_initisOk, Eigen::PastixBase< Derived >::m_invp, Eigen::PastixBase< Derived >::m_iparm, Eigen::PastixBase< Derived >::m_pastixdata, and Eigen::PastixBase< Derived >::m_perm.

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

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

◆ cols()

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

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

◆ compute()

template<class Derived >
void Eigen::PastixBase< Derived >::compute ( ColSpMatrix mat)
protected
296{
297 eigen_assert(mat.rows() == mat.cols() && "The input matrix should be squared");
298
299 analyzePattern(mat);
300 factorize(mat);
301
302 m_iparm(IPARM_MATRIX_VERIFICATION) = API_NO;
303}
void analyzePattern(ColSpMatrix &mat)
Definition PaStiXSupport.h:307
void factorize(ColSpMatrix &mat)
Definition PaStiXSupport.h:338

References Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::cols(), eigen_assert, and Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::rows().

Referenced by Eigen::PastixLU< _MatrixType, IsStrSym >::compute(), Eigen::PastixLLT< _MatrixType, _UpLo >::compute(), and Eigen::PastixLDLT< _MatrixType, _UpLo >::compute().

+ Here is the call graph for this function:
+ Here is the caller 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); }

◆ dparm() [1/2]

template<class Derived >
Array< double, DPARM_SIZE, 1 > & Eigen::PastixBase< Derived >::dparm ( )
inline

Returns a reference to the double vector DPARM of PaStiX parameters The statistics related to the different phases of factorization and solve are saved here as well

See also
analyzePattern() factorize()
188 {
189 return m_dparm;
190 }

References Eigen::PastixBase< Derived >::m_dparm.

◆ dparm() [2/2]

template<class Derived >
double & Eigen::PastixBase< Derived >::dparm ( int  idxparam)
inline

Return a reference to a particular index parameter of the DPARM vector

See also
dparm()
197 {
198 return m_dparm(idxparam);
199 }

References Eigen::PastixBase< Derived >::m_dparm.

◆ factorize()

template<class Derived >
void Eigen::PastixBase< Derived >::factorize ( ColSpMatrix mat)
protected
339{
340// if(&m_cpyMat != &mat) m_cpyMat = mat;
341 eigen_assert(m_analysisIsOk && "The analysis phase should be called before the factorization phase");
342 m_iparm(IPARM_START_TASK) = API_TASK_NUMFACT;
343 m_iparm(IPARM_END_TASK) = API_TASK_NUMFACT;
344 m_size = internal::convert_index<int>(mat.rows());
345
346 internal::eigen_pastix(&m_pastixdata, MPI_COMM_WORLD, m_size, mat.outerIndexPtr(), mat.innerIndexPtr(),
347 mat.valuePtr(), m_perm.data(), m_invp.data(), 0, 0, m_iparm.data(), m_dparm.data());
348
349 // Check the returned error
350 if(m_iparm(IPARM_ERROR_NUMBER))
351 {
353 m_factorizationIsOk = false;
354 m_isInitialized = false;
355 }
356 else
357 {
358 m_info = Success;
359 m_factorizationIsOk = true;
360 m_isInitialized = true;
361 }
362}

References eigen_assert, Eigen::internal::eigen_pastix(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::innerIndexPtr(), Eigen::NumericalIssue, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::outerIndexPtr(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::rows(), Eigen::Success, and Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::valuePtr().

Referenced by Eigen::PastixLU< _MatrixType, IsStrSym >::factorize(), Eigen::PastixLLT< _MatrixType, _UpLo >::factorize(), and Eigen::PastixLDLT< _MatrixType, _UpLo >::factorize().

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

◆ info()

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

Reports whether previous computation was successful.

Returns
Success if computation was succesful, NumericalIssue if the PaStiX reports a problem InvalidInput if the input matrix is invalid
See also
iparm()
213 {
214 eigen_assert(m_isInitialized && "Decomposition is not initialized.");
215 return m_info;
216 }

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

◆ init()

template<class Derived >
void Eigen::PastixBase< Derived >::init
protected

Initialize the PaStiX data structure. A first call to this function fills iparm and dparm with the default PaStiX parameters

See also
iparm() dparm()
260{
261 m_size = 0;
262 m_iparm.setZero(IPARM_SIZE);
263 m_dparm.setZero(DPARM_SIZE);
264
265 m_iparm(IPARM_MODIFY_PARAMETER) = API_NO;
266 pastix(&m_pastixdata, MPI_COMM_WORLD,
267 0, 0, 0, 0,
268 0, 0, 0, 1, m_iparm.data(), m_dparm.data());
269
270 m_iparm[IPARM_MATRIX_VERIFICATION] = API_NO;
271 m_iparm[IPARM_VERBOSE] = API_VERBOSE_NOT;
272 m_iparm[IPARM_ORDERING] = API_ORDER_SCOTCH;
273 m_iparm[IPARM_INCOMPLETE] = API_NO;
274 m_iparm[IPARM_OOC_LIMIT] = 2000;
275 m_iparm[IPARM_RHS_MAKING] = API_RHS_B;
276 m_iparm(IPARM_MATRIX_VERIFICATION) = API_NO;
277
278 m_iparm(IPARM_START_TASK) = API_TASK_INIT;
279 m_iparm(IPARM_END_TASK) = API_TASK_INIT;
280 internal::eigen_pastix(&m_pastixdata, MPI_COMM_WORLD, 0, 0, 0, (Scalar*)0,
281 0, 0, 0, 0, m_iparm.data(), m_dparm.data());
282
283 // Check the returned error
284 if(m_iparm(IPARM_ERROR_NUMBER)) {
286 m_initisOk = false;
287 }
288 else {
289 m_info = Success;
290 m_initisOk = true;
291 }
292}
EIGEN_DEVICE_FUNC Derived & setZero(Index size)
Definition CwiseNullaryOp.h:515
@ InvalidInput
Definition Constants.h:439

References Eigen::internal::eigen_pastix(), Eigen::InvalidInput, and Eigen::Success.

Referenced by Eigen::PastixBase< Derived >::PastixBase().

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

◆ iparm() [1/2]

template<class Derived >
Array< StorageIndex, IPARM_SIZE, 1 > & Eigen::PastixBase< Derived >::iparm ( )
inline

Returns a reference to the integer vector IPARM of PaStiX parameters to modify the default parameters. The statistics related to the different phases of factorization and solve are saved here as well

See also
analyzePattern() factorize()
170 {
171 return m_iparm;
172 }

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

◆ iparm() [2/2]

template<class Derived >
int & Eigen::PastixBase< Derived >::iparm ( int  idxparam)
inline

Return a reference to a particular index parameter of the IPARM vector

See also
iparm()
179 {
180 return m_iparm(idxparam);
181 }

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

◆ rows()

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

References Eigen::PastixBase< 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 >
int Eigen::PastixBase< Derived >::m_analysisIsOk
protected

◆ m_comm

template<class Derived >
int Eigen::PastixBase< Derived >::m_comm
mutableprotected

◆ m_dparm

template<class Derived >
Array<double,DPARM_SIZE,1> Eigen::PastixBase< Derived >::m_dparm
mutableprotected

◆ m_factorizationIsOk

template<class Derived >
int Eigen::PastixBase< Derived >::m_factorizationIsOk
protected

◆ m_info

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

◆ m_initisOk

template<class Derived >
int Eigen::PastixBase< Derived >::m_initisOk
protected

◆ m_invp

template<class Derived >
Matrix<StorageIndex,Dynamic,1> Eigen::PastixBase< Derived >::m_invp
mutableprotected

◆ m_iparm

template<class Derived >
Array<int,IPARM_SIZE,1> Eigen::PastixBase< Derived >::m_iparm
mutableprotected

◆ m_isInitialized

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

◆ m_pastixdata

template<class Derived >
pastix_data_t* Eigen::PastixBase< Derived >::m_pastixdata
mutableprotected

◆ m_perm

template<class Derived >
Matrix<StorageIndex,Dynamic,1> Eigen::PastixBase< Derived >::m_perm
mutableprotected

◆ m_size

template<class Derived >
int Eigen::PastixBase< Derived >::m_size
mutableprotected

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