Eigen::PastixBase< Derived > Class Template Reference
+ Inheritance diagram for Eigen::PastixBase< Derived >:

Public Types

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

Public Member Functions

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

Protected Types

typedef SparseSolverBase< Derived > Base
 

Protected Member Functions

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

Protected Attributes

int m_analysisIsOk
 
int m_comm
 
Array< double, DPARM_SIZE, 1 > m_dparm
 
int m_factorizationIsOk
 
ComputationInfo m_info
 
int m_initisOk
 
Matrix< StorageIndex, Dynamic, 1 > m_invp
 
Array< int, IPARM_SIZE, 1 > m_iparm
 
bool m_isInitialized
 
pastix_data_t * m_pastixdata
 
Matrix< StorageIndex, Dynamic, 1 > m_perm
 
int m_size
 
- Protected Attributes inherited from Eigen::SparseSolverBase< Derived >
bool m_isInitialized
 

Detailed Description

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

Definition at line 130 of file PaStiXSupport.h.

Member Typedef Documentation

◆ Base

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

Definition at line 133 of file PaStiXSupport.h.

◆ ColSpMatrix

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

Definition at line 145 of file PaStiXSupport.h.

◆ MatrixType

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

Definition at line 140 of file PaStiXSupport.h.

◆ MatrixType_

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

Definition at line 139 of file PaStiXSupport.h.

◆ RealScalar

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

Definition at line 142 of file PaStiXSupport.h.

◆ Scalar

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

Definition at line 141 of file PaStiXSupport.h.

◆ StorageIndex

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

Definition at line 143 of file PaStiXSupport.h.

◆ Vector

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

Definition at line 144 of file PaStiXSupport.h.

Member Enumeration Documentation

◆ anonymous enum

template<class Derived >
anonymous enum
Enumerator
ColsAtCompileTime 
MaxColsAtCompileTime 

Definition at line 146 of file PaStiXSupport.h.

146  {
147  ColsAtCompileTime = MatrixType::ColsAtCompileTime,
148  MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime
149  };

Constructor & Destructor Documentation

◆ PastixBase()

template<class Derived >
Eigen::PastixBase< Derived >::PastixBase ( )
inline

Definition at line 153 of file PaStiXSupport.h.

153  : m_initisOk(false), m_analysisIsOk(false), m_factorizationIsOk(false), m_pastixdata(0), m_size(0)
154  {
155  init();
156  }
pastix_data_t * m_pastixdata

◆ ~PastixBase()

template<class Derived >
Eigen::PastixBase< Derived >::~PastixBase ( )
inline

Definition at line 158 of file PaStiXSupport.h.

159  {
160  clean();
161  }

Member Function Documentation

◆ _solve_impl()

template<typename Base >
template<typename Rhs , typename Dest >
bool Eigen::PastixBase< Base >::_solve_impl ( const MatrixBase< Rhs > &  b,
MatrixBase< Dest > &  x 
) const

Definition at line 369 of file PaStiXSupport.h.

370 {
371  eigen_assert(m_isInitialized && "The matrix should be factorized first");
372  EIGEN_STATIC_ASSERT((Dest::Flags&RowMajorBit)==0,
373  THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES);
374  int rhs = 1;
375 
376  x = b; /* on return, x is overwritten by the computed solution */
377 
378  for (int i = 0; i < b.cols(); i++){
379  m_iparm[IPARM_START_TASK] = API_TASK_SOLVE;
380  m_iparm[IPARM_END_TASK] = API_TASK_REFINE;
381 
382  internal::eigen_pastix(&m_pastixdata, MPI_COMM_WORLD, internal::convert_index<int>(x.rows()), 0, 0, 0,
383  m_perm.data(), m_invp.data(), &x(0, i), rhs, m_iparm.data(), m_dparm.data());
384  }
385 
386  // Check the returned error
387  m_info = m_iparm(IPARM_ERROR_NUMBER)==0 ? Success : NumericalIssue;
388 
389  return m_iparm(IPARM_ERROR_NUMBER)==0;
390 }
Array< int, 3, 1 > b
#define eigen_assert(x)
Definition: Macros.h:902
#define EIGEN_STATIC_ASSERT(X, MSG)
Definition: StaticAssert.h:26
Array< double, DPARM_SIZE, 1 > m_dparm
Matrix< StorageIndex, Dynamic, 1 > m_invp
Matrix< StorageIndex, Dynamic, 1 > m_perm
Array< int, IPARM_SIZE, 1 > m_iparm
ComputationInfo m_info
const Scalar * data() const
@ NumericalIssue
Definition: Constants.h:448
@ Success
Definition: Constants.h:446
const unsigned int RowMajorBit
Definition: Constants.h:68
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:69

◆ analyzePattern()

template<class Derived >
void Eigen::PastixBase< Derived >::analyzePattern ( ColSpMatrix mat)
protected

Definition at line 309 of file PaStiXSupport.h.

310 {
311  eigen_assert(m_initisOk && "The initialization of PaSTiX failed");
312 
313  // clean previous calls
314  if(m_size>0)
315  clean();
316 
317  m_size = internal::convert_index<int>(mat.rows());
320 
321  m_iparm(IPARM_START_TASK) = API_TASK_ORDERING;
322  m_iparm(IPARM_END_TASK) = API_TASK_ANALYSE;
323  internal::eigen_pastix(&m_pastixdata, MPI_COMM_WORLD, m_size, mat.outerIndexPtr(), mat.innerIndexPtr(),
324  mat.valuePtr(), m_perm.data(), m_invp.data(), 0, 0, m_iparm.data(), m_dparm.data());
325 
326  // Check the returned error
327  if(m_iparm(IPARM_ERROR_NUMBER))
328  {
330  m_analysisIsOk = false;
331  }
332  else
333  {
334  m_info = Success;
335  m_analysisIsOk = true;
336  }
337 }
constexpr void resize(Index rows, Index cols)

◆ clean()

template<class Derived >
void Eigen::PastixBase< Derived >::clean ( )
inlineprotected

Definition at line 232 of file PaStiXSupport.h.

233  {
234  eigen_assert(m_initisOk && "The Pastix structure should be allocated first");
235  m_iparm(IPARM_START_TASK) = API_TASK_CLEAN;
236  m_iparm(IPARM_END_TASK) = API_TASK_CLEAN;
237  internal::eigen_pastix(&m_pastixdata, MPI_COMM_WORLD, 0, 0, 0, (Scalar*)0,
238  m_perm.data(), m_invp.data(), 0, 0, m_iparm.data(), m_dparm.data());
239  }
MatrixType::Scalar Scalar

◆ cols()

template<class Derived >
Index Eigen::PastixBase< Derived >::cols ( void  ) const
inline

Definition at line 203 of file PaStiXSupport.h.

203 { return m_size; }

◆ compute()

template<class Derived >
void Eigen::PastixBase< Derived >::compute ( ColSpMatrix mat)
protected

Definition at line 297 of file PaStiXSupport.h.

298 {
299  eigen_assert(mat.rows() == mat.cols() && "The input matrix should be squared");
300 
302  factorize(mat);
303 
304  m_iparm(IPARM_MATRIX_VERIFICATION) = API_NO;
305 }
void analyzePattern(ColSpMatrix &mat)
void factorize(ColSpMatrix &mat)

◆ derived() [1/2]

template<class Derived >
Derived& Eigen::SparseSolverBase< Derived >::derived
inlineprotected

Definition at line 83 of file SparseSolverBase.h.

83 { return *static_cast<Derived*>(this); }

◆ derived() [2/2]

template<class Derived >
const Derived& Eigen::SparseSolverBase< Derived >::derived
inlineprotected

Definition at line 84 of file SparseSolverBase.h.

84 { 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()

Definition at line 189 of file PaStiXSupport.h.

190  {
191  return m_dparm;
192  }

◆ 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()

Definition at line 198 of file PaStiXSupport.h.

199  {
200  return m_dparm(idxparam);
201  }

◆ factorize()

template<class Derived >
void Eigen::PastixBase< Derived >::factorize ( ColSpMatrix mat)
protected

Definition at line 340 of file PaStiXSupport.h.

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

◆ info()

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

Reports whether previous computation was successful.

Returns
Success if computation was successful, NumericalIssue if the PaStiX reports a problem InvalidInput if the input matrix is invalid
See also
iparm()

Definition at line 214 of file PaStiXSupport.h.

215  {
216  eigen_assert(m_isInitialized && "Decomposition is not initialized.");
217  return m_info;
218  }

◆ 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()

Definition at line 261 of file PaStiXSupport.h.

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

◆ 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()

Definition at line 171 of file PaStiXSupport.h.

172  {
173  return m_iparm;
174  }

◆ 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()

Definition at line 180 of file PaStiXSupport.h.

181  {
182  return m_iparm(idxparam);
183  }

◆ rows()

template<class Derived >
Index Eigen::PastixBase< Derived >::rows ( void  ) const
inline

Definition at line 204 of file PaStiXSupport.h.

204 { return m_size; }

Member Data Documentation

◆ m_analysisIsOk

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

Definition at line 244 of file PaStiXSupport.h.

◆ m_comm

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

Definition at line 248 of file PaStiXSupport.h.

◆ m_dparm

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

Definition at line 250 of file PaStiXSupport.h.

◆ m_factorizationIsOk

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

Definition at line 245 of file PaStiXSupport.h.

◆ m_info

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

Definition at line 246 of file PaStiXSupport.h.

◆ m_initisOk

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

Definition at line 243 of file PaStiXSupport.h.

◆ m_invp

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

Definition at line 252 of file PaStiXSupport.h.

◆ m_iparm

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

Definition at line 249 of file PaStiXSupport.h.

◆ m_isInitialized

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

Definition at line 123 of file SparseSolverBase.h.

◆ m_pastixdata

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

Definition at line 247 of file PaStiXSupport.h.

◆ m_perm

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

Definition at line 251 of file PaStiXSupport.h.

◆ m_size

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

Definition at line 253 of file PaStiXSupport.h.


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