MOAB  4.9.3pre
Eigen::PastixBase< Derived > Class Template Reference

#include <PaStiXSupport.h>

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

List of all members.

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,
ColMajor
ColSpMatrix

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.

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)

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

Detailed Description

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

Definition at line 128 of file PaStiXSupport.h.


Member Typedef Documentation

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

Definition at line 137 of file PaStiXSupport.h.

template<class Derived>
typedef SparseSolverBase<Derived> Eigen::PastixBase< Derived >::Base [protected]
template<class Derived>
typedef MatrixType::RealScalar Eigen::PastixBase< Derived >::RealScalar

Definition at line 140 of file PaStiXSupport.h.

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

Definition at line 139 of file PaStiXSupport.h.

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

Reimplemented in Eigen::PastixLU< _MatrixType, IsStrSym >.

Definition at line 141 of file PaStiXSupport.h.

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

Definition at line 142 of file PaStiXSupport.h.


Member Enumeration Documentation

template<class Derived>
anonymous enum
Enumerator:
ColsAtCompileTime 
MaxColsAtCompileTime 

Definition at line 144 of file PaStiXSupport.h.

         {
      ColsAtCompileTime = MatrixType::ColsAtCompileTime,
      MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime
    };

Constructor & Destructor Documentation

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

Definition at line 151 of file PaStiXSupport.h.

                 : m_initisOk(false), m_analysisIsOk(false), m_factorizationIsOk(false), m_pastixdata(0), m_size(0)
    {
      init();
    }
template<class Derived>
Eigen::PastixBase< Derived >::~PastixBase ( ) [inline]

Definition at line 156 of file PaStiXSupport.h.

    {
      clean();
    }

Member Function Documentation

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 367 of file PaStiXSupport.h.

{
  eigen_assert(m_isInitialized && "The matrix should be factorized first");
  EIGEN_STATIC_ASSERT((Dest::Flags&RowMajorBit)==0,
                     THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES);
  int rhs = 1;
  
  x = b; /* on return, x is overwritten by the computed solution */
  
  for (int i = 0; i < b.cols(); i++){
    m_iparm[IPARM_START_TASK]          = API_TASK_SOLVE;
    m_iparm[IPARM_END_TASK]            = API_TASK_REFINE;
  
    internal::eigen_pastix(&m_pastixdata, MPI_COMM_WORLD, internal::convert_index<int>(x.rows()), 0, 0, 0,
                           m_perm.data(), m_invp.data(), &x(0, i), rhs, m_iparm.data(), m_dparm.data());
  }
  
  // Check the returned error
  m_info = m_iparm(IPARM_ERROR_NUMBER)==0 ? Success : NumericalIssue;
  
  return m_iparm(IPARM_ERROR_NUMBER)==0;
}
template<class Derived >
void Eigen::PastixBase< Derived >::analyzePattern ( ColSpMatrix mat) [protected]

Definition at line 307 of file PaStiXSupport.h.

{                         
  eigen_assert(m_initisOk && "The initialization of PaSTiX failed");
  
  // clean previous calls
  if(m_size>0)
    clean();
  
  m_size = internal::convert_index<int>(mat.rows());
  m_perm.resize(m_size);
  m_invp.resize(m_size);
  
  m_iparm(IPARM_START_TASK) = API_TASK_ORDERING;
  m_iparm(IPARM_END_TASK) = API_TASK_ANALYSE;
  internal::eigen_pastix(&m_pastixdata, MPI_COMM_WORLD, m_size, mat.outerIndexPtr(), mat.innerIndexPtr(),
               mat.valuePtr(), m_perm.data(), m_invp.data(), 0, 0, m_iparm.data(), m_dparm.data());
  
  // Check the returned error
  if(m_iparm(IPARM_ERROR_NUMBER))
  {
    m_info = NumericalIssue;
    m_analysisIsOk = false;
  }
  else
  { 
    m_info = Success;
    m_analysisIsOk = true;
  }
}
template<class Derived>
void Eigen::PastixBase< Derived >::clean ( ) [inline, protected]

Definition at line 230 of file PaStiXSupport.h.

    {
      eigen_assert(m_initisOk && "The Pastix structure should be allocated first"); 
      m_iparm(IPARM_START_TASK) = API_TASK_CLEAN;
      m_iparm(IPARM_END_TASK) = API_TASK_CLEAN;
      internal::eigen_pastix(&m_pastixdata, MPI_COMM_WORLD, 0, 0, 0, (Scalar*)0,
                             m_perm.data(), m_invp.data(), 0, 0, m_iparm.data(), m_dparm.data());
    }
template<class Derived>
Index Eigen::PastixBase< Derived >::cols ( void  ) const [inline]

Definition at line 201 of file PaStiXSupport.h.

{ return m_size; }
template<class Derived >
void Eigen::PastixBase< Derived >::compute ( ColSpMatrix mat) [protected]

Definition at line 295 of file PaStiXSupport.h.

{
  eigen_assert(mat.rows() == mat.cols() && "The input matrix should be squared");
  
  analyzePattern(mat);  
  factorize(mat);
  
  m_iparm(IPARM_MATRIX_VERIFICATION) = API_NO;
}
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 187 of file PaStiXSupport.h.

    {
      return m_dparm; 
    }
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 196 of file PaStiXSupport.h.

    {
      return m_dparm(idxparam);
    }
template<class Derived >
void Eigen::PastixBase< Derived >::factorize ( ColSpMatrix mat) [protected]

Definition at line 338 of file PaStiXSupport.h.

{
//   if(&m_cpyMat != &mat) m_cpyMat = mat;
  eigen_assert(m_analysisIsOk && "The analysis phase should be called before the factorization phase");
  m_iparm(IPARM_START_TASK) = API_TASK_NUMFACT;
  m_iparm(IPARM_END_TASK) = API_TASK_NUMFACT;
  m_size = internal::convert_index<int>(mat.rows());
  
  internal::eigen_pastix(&m_pastixdata, MPI_COMM_WORLD, m_size, mat.outerIndexPtr(), mat.innerIndexPtr(),
               mat.valuePtr(), m_perm.data(), m_invp.data(), 0, 0, m_iparm.data(), m_dparm.data());
  
  // Check the returned error
  if(m_iparm(IPARM_ERROR_NUMBER))
  {
    m_info = NumericalIssue;
    m_factorizationIsOk = false;
    m_isInitialized = false;
  }
  else
  {
    m_info = Success;
    m_factorizationIsOk = true;
    m_isInitialized = true;
  }
}
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()

Definition at line 212 of file PaStiXSupport.h.

    {
      eigen_assert(m_isInitialized && "Decomposition is not initialized.");
      return m_info;
    }
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()

Reimplemented in Eigen::PastixLDLT< _MatrixType, _UpLo >, Eigen::PastixLLT< _MatrixType, _UpLo >, and Eigen::PastixLU< _MatrixType, IsStrSym >.

Definition at line 259 of file PaStiXSupport.h.

{
  m_size = 0; 
  m_iparm.setZero(IPARM_SIZE);
  m_dparm.setZero(DPARM_SIZE);
  
  m_iparm(IPARM_MODIFY_PARAMETER) = API_NO;
  pastix(&m_pastixdata, MPI_COMM_WORLD,
         0, 0, 0, 0,
         0, 0, 0, 1, m_iparm.data(), m_dparm.data());
  
  m_iparm[IPARM_MATRIX_VERIFICATION] = API_NO;
  m_iparm[IPARM_VERBOSE]             = API_VERBOSE_NOT;
  m_iparm[IPARM_ORDERING]            = API_ORDER_SCOTCH;
  m_iparm[IPARM_INCOMPLETE]          = API_NO;
  m_iparm[IPARM_OOC_LIMIT]           = 2000;
  m_iparm[IPARM_RHS_MAKING]          = API_RHS_B;
  m_iparm(IPARM_MATRIX_VERIFICATION) = API_NO;
  
  m_iparm(IPARM_START_TASK) = API_TASK_INIT;
  m_iparm(IPARM_END_TASK) = API_TASK_INIT;
  internal::eigen_pastix(&m_pastixdata, MPI_COMM_WORLD, 0, 0, 0, (Scalar*)0,
                         0, 0, 0, 0, m_iparm.data(), m_dparm.data());
  
  // Check the returned error
  if(m_iparm(IPARM_ERROR_NUMBER)) {
    m_info = InvalidInput;
    m_initisOk = false;
  }
  else { 
    m_info = Success;
    m_initisOk = true;
  }
}
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 169 of file PaStiXSupport.h.

    {
      return m_iparm; 
    }
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 178 of file PaStiXSupport.h.

    {
      return m_iparm(idxparam);
    }
template<class Derived>
Index Eigen::PastixBase< Derived >::rows ( void  ) const [inline]

Definition at line 202 of file PaStiXSupport.h.

{ return m_size; }

Member Data Documentation

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

Definition at line 242 of file PaStiXSupport.h.

template<class Derived>
int Eigen::PastixBase< Derived >::m_comm [mutable, protected]

Definition at line 246 of file PaStiXSupport.h.

template<class Derived>
Array<double,DPARM_SIZE,1> Eigen::PastixBase< Derived >::m_dparm [mutable, protected]

Definition at line 248 of file PaStiXSupport.h.

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

Definition at line 243 of file PaStiXSupport.h.

template<class Derived>
ComputationInfo Eigen::PastixBase< Derived >::m_info [mutable, protected]

Definition at line 244 of file PaStiXSupport.h.

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

Definition at line 241 of file PaStiXSupport.h.

template<class Derived>
Matrix<StorageIndex,Dynamic,1> Eigen::PastixBase< Derived >::m_invp [mutable, protected]

Definition at line 250 of file PaStiXSupport.h.

template<class Derived>
Array<int,IPARM_SIZE,1> Eigen::PastixBase< Derived >::m_iparm [mutable, protected]

Definition at line 247 of file PaStiXSupport.h.

template<class Derived>
pastix_data_t* Eigen::PastixBase< Derived >::m_pastixdata [mutable, protected]

Definition at line 245 of file PaStiXSupport.h.

template<class Derived>
Matrix<StorageIndex,Dynamic,1> Eigen::PastixBase< Derived >::m_perm [mutable, protected]

Definition at line 249 of file PaStiXSupport.h.

template<class Derived>
int Eigen::PastixBase< Derived >::m_size [mutable, protected]

Definition at line 251 of file PaStiXSupport.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines