Eigen::SuperLUBase< MatrixType_, Derived > Class Template Reference

The base class for the direct and incomplete LU factorization of SuperLU. More...

+ Inheritance diagram for Eigen::SuperLUBase< MatrixType_, Derived >:

Public Types

enum  {
  ColsAtCompileTime ,
  MaxColsAtCompileTime
}
 
typedef Matrix< int, MatrixType::RowsAtCompileTime, 1 > IntColVectorType
 
typedef Matrix< int, 1, MatrixType::ColsAtCompileTime > IntRowVectorType
 
typedef SparseMatrix< ScalarLUMatrixType
 
typedef MatrixType_ MatrixType
 
typedef Map< PermutationMatrix< Dynamic, Dynamic, int > > PermutationMap
 
typedef MatrixType::RealScalar RealScalar
 
typedef MatrixType::Scalar Scalar
 
typedef MatrixType::StorageIndex StorageIndex
 
typedef Matrix< Scalar, Dynamic, 1 > Vector
 

Public Member Functions

void analyzePattern (const MatrixType &)
 
Index cols () const
 
void compute (const MatrixType &matrix)
 
template<typename Stream >
void dumpMemory (Stream &)
 
ComputationInfo info () const
 Reports whether previous computation was successful. More...
 
superlu_options_t & options ()
 
Index rows () const
 
 SuperLUBase ()
 
 ~SuperLUBase ()
 
- 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 clearFactors ()
 
Derived & derived ()
 
const Derived & derived () const
 
void extractData () const
 
void init ()
 
void initFactorization (const MatrixType &a)
 

Protected Attributes

int m_analysisIsOk
 
bool m_extractedDataAreDirty
 
int m_factorizationIsOk
 
ComputationInfo m_info
 
bool m_isInitialized
 
LUMatrixType m_l
 
LUMatrixType m_matrix
 
IntColVectorType m_p
 
IntRowVectorType m_q
 
SluMatrix m_sluA
 
SluMatrix m_sluB
 
Matrix< RealScalar, Dynamic, 1 > m_sluBerr
 
Matrix< RealScalar, Dynamic, 1 > m_sluCscale
 
char m_sluEqued
 
std::vector< int > m_sluEtree
 
Matrix< RealScalar, Dynamic, 1 > m_sluFerr
 
SuperMatrix m_sluL
 
superlu_options_t m_sluOptions
 
Matrix< RealScalar, Dynamic, 1 > m_sluRscale
 
SuperLUStat_t m_sluStat
 
SuperMatrix m_sluU
 
SluMatrix m_sluX
 
LUMatrixType m_u
 
- Protected Attributes inherited from Eigen::SparseSolverBase< Derived >
bool m_isInitialized
 

Private Member Functions

 SuperLUBase (SuperLUBase &)
 

Detailed Description

template<typename MatrixType_, typename Derived>
class Eigen::SuperLUBase< MatrixType_, Derived >

The base class for the direct and incomplete LU factorization of SuperLU.

Definition at line 319 of file SuperLUSupport.h.

Member Typedef Documentation

◆ Base

template<typename MatrixType_ , typename Derived >
typedef SparseSolverBase<Derived> Eigen::SuperLUBase< MatrixType_, Derived >::Base
protected

Definition at line 322 of file SuperLUSupport.h.

◆ IntColVectorType

template<typename MatrixType_ , typename Derived >
typedef Matrix<int, MatrixType::RowsAtCompileTime, 1> Eigen::SuperLUBase< MatrixType_, Derived >::IntColVectorType

Definition at line 332 of file SuperLUSupport.h.

◆ IntRowVectorType

template<typename MatrixType_ , typename Derived >
typedef Matrix<int, 1, MatrixType::ColsAtCompileTime> Eigen::SuperLUBase< MatrixType_, Derived >::IntRowVectorType

Definition at line 331 of file SuperLUSupport.h.

◆ LUMatrixType

template<typename MatrixType_ , typename Derived >
typedef SparseMatrix<Scalar> Eigen::SuperLUBase< MatrixType_, Derived >::LUMatrixType

Definition at line 334 of file SuperLUSupport.h.

◆ MatrixType

template<typename MatrixType_ , typename Derived >
typedef MatrixType_ Eigen::SuperLUBase< MatrixType_, Derived >::MatrixType

Definition at line 326 of file SuperLUSupport.h.

◆ PermutationMap

template<typename MatrixType_ , typename Derived >
typedef Map<PermutationMatrix<Dynamic,Dynamic,int> > Eigen::SuperLUBase< MatrixType_, Derived >::PermutationMap

Definition at line 333 of file SuperLUSupport.h.

◆ RealScalar

template<typename MatrixType_ , typename Derived >
typedef MatrixType::RealScalar Eigen::SuperLUBase< MatrixType_, Derived >::RealScalar

Definition at line 328 of file SuperLUSupport.h.

◆ Scalar

template<typename MatrixType_ , typename Derived >
typedef MatrixType::Scalar Eigen::SuperLUBase< MatrixType_, Derived >::Scalar

Definition at line 327 of file SuperLUSupport.h.

◆ StorageIndex

template<typename MatrixType_ , typename Derived >
typedef MatrixType::StorageIndex Eigen::SuperLUBase< MatrixType_, Derived >::StorageIndex

Definition at line 329 of file SuperLUSupport.h.

◆ Vector

template<typename MatrixType_ , typename Derived >
typedef Matrix<Scalar,Dynamic,1> Eigen::SuperLUBase< MatrixType_, Derived >::Vector

Definition at line 330 of file SuperLUSupport.h.

Member Enumeration Documentation

◆ anonymous enum

template<typename MatrixType_ , typename Derived >
anonymous enum
Enumerator
ColsAtCompileTime 
MaxColsAtCompileTime 

Definition at line 335 of file SuperLUSupport.h.

335  {
336  ColsAtCompileTime = MatrixType::ColsAtCompileTime,
337  MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime
338  };

Constructor & Destructor Documentation

◆ SuperLUBase() [1/2]

template<typename MatrixType_ , typename Derived >
Eigen::SuperLUBase< MatrixType_, Derived >::SuperLUBase ( )
inline

Definition at line 342 of file SuperLUSupport.h.

342 {}

◆ ~SuperLUBase()

template<typename MatrixType_ , typename Derived >
Eigen::SuperLUBase< MatrixType_, Derived >::~SuperLUBase ( )
inline

Definition at line 344 of file SuperLUSupport.h.

345  {
346  clearFactors();
347  }

◆ SuperLUBase() [2/2]

template<typename MatrixType_ , typename Derived >
Eigen::SuperLUBase< MatrixType_, Derived >::SuperLUBase ( SuperLUBase< MatrixType_, Derived > &  )
inlineprivate

Definition at line 469 of file SuperLUSupport.h.

469 { }

Member Function Documentation

◆ analyzePattern()

template<typename MatrixType_ , typename Derived >
void Eigen::SuperLUBase< MatrixType_, Derived >::analyzePattern ( const MatrixType )
inline

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

Definition at line 379 of file SuperLUSupport.h.

380  {
381  m_isInitialized = true;
382  m_info = Success;
383  m_analysisIsOk = true;
384  m_factorizationIsOk = false;
385  }
ComputationInfo m_info
@ Success
Definition: Constants.h:446

◆ clearFactors()

template<typename MatrixType_ , typename Derived >
void Eigen::SuperLUBase< MatrixType_, Derived >::clearFactors ( )
inlineprotected

Definition at line 432 of file SuperLUSupport.h.

433  {
434  if(m_sluL.Store)
435  Destroy_SuperNode_Matrix(&m_sluL);
436  if(m_sluU.Store)
437  Destroy_CompCol_Matrix(&m_sluU);
438 
439  m_sluL.Store = 0;
440  m_sluU.Store = 0;
441 
442  memset(&m_sluL,0,sizeof m_sluL);
443  memset(&m_sluU,0,sizeof m_sluU);
444  }

◆ cols()

template<typename MatrixType_ , typename Derived >
Index Eigen::SuperLUBase< MatrixType_, Derived >::cols ( void  ) const
inline

Definition at line 350 of file SuperLUSupport.h.

350 { return m_matrix.cols(); }
Index cols() const
Definition: SparseMatrix.h:167
LUMatrixType m_matrix

◆ compute()

template<typename MatrixType_ , typename Derived >
void Eigen::SuperLUBase< MatrixType_, Derived >::compute ( const MatrixType matrix)
inline

Computes the sparse Cholesky decomposition of matrix

Definition at line 367 of file SuperLUSupport.h.

368  {
369  derived().analyzePattern(matrix);
370  derived().factorize(matrix);
371  }

◆ derived() [1/2]

template<typename MatrixType_ , typename 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<typename MatrixType_ , typename Derived >
const Derived& Eigen::SparseSolverBase< Derived >::derived
inlineprotected

Definition at line 84 of file SparseSolverBase.h.

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

◆ dumpMemory()

template<typename MatrixType_ , typename Derived >
template<typename Stream >
void Eigen::SuperLUBase< MatrixType_, Derived >::dumpMemory ( Stream &  )
inline

Definition at line 388 of file SuperLUSupport.h.

389  {}

◆ extractData()

template<typename MatrixType , typename Derived >
void Eigen::SuperLUBase< MatrixType, Derived >::extractData
protected

Definition at line 708 of file SuperLUSupport.h.

709 {
710  eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for extracting factors, you must first call either compute() or analyzePattern()/factorize()");
712  {
713  int upper;
714  int fsupc, istart, nsupr;
715  int lastl = 0, lastu = 0;
716  SCformat *Lstore = static_cast<SCformat*>(m_sluL.Store);
717  NCformat *Ustore = static_cast<NCformat*>(m_sluU.Store);
718  Scalar *SNptr;
719 
720  const Index size = m_matrix.rows();
721  m_l.resize(size,size);
722  m_l.resizeNonZeros(Lstore->nnz);
723  m_u.resize(size,size);
724  m_u.resizeNonZeros(Ustore->nnz);
725 
726  int* Lcol = m_l.outerIndexPtr();
727  int* Lrow = m_l.innerIndexPtr();
728  Scalar* Lval = m_l.valuePtr();
729 
730  int* Ucol = m_u.outerIndexPtr();
731  int* Urow = m_u.innerIndexPtr();
732  Scalar* Uval = m_u.valuePtr();
733 
734  Ucol[0] = 0;
735  Ucol[0] = 0;
736 
737  /* for each supernode */
738  for (int k = 0; k <= Lstore->nsuper; ++k)
739  {
740  fsupc = L_FST_SUPC(k);
741  istart = L_SUB_START(fsupc);
742  nsupr = L_SUB_START(fsupc+1) - istart;
743  upper = 1;
744 
745  /* for each column in the supernode */
746  for (int j = fsupc; j < L_FST_SUPC(k+1); ++j)
747  {
748  SNptr = &((Scalar*)Lstore->nzval)[L_NZ_START(j)];
749 
750  /* Extract U */
751  for (int i = U_NZ_START(j); i < U_NZ_START(j+1); ++i)
752  {
753  Uval[lastu] = ((Scalar*)Ustore->nzval)[i];
754  /* Matlab doesn't like explicit zero. */
755  if (Uval[lastu] != 0.0)
756  Urow[lastu++] = U_SUB(i);
757  }
758  for (int i = 0; i < upper; ++i)
759  {
760  /* upper triangle in the supernode */
761  Uval[lastu] = SNptr[i];
762  /* Matlab doesn't like explicit zero. */
763  if (Uval[lastu] != 0.0)
764  Urow[lastu++] = L_SUB(istart+i);
765  }
766  Ucol[j+1] = lastu;
767 
768  /* Extract L */
769  Lval[lastl] = 1.0; /* unit diagonal */
770  Lrow[lastl++] = L_SUB(istart + upper - 1);
771  for (int i = upper; i < nsupr; ++i)
772  {
773  Lval[lastl] = SNptr[i];
774  /* Matlab doesn't like explicit zero. */
775  if (Lval[lastl] != 0.0)
776  Lrow[lastl++] = L_SUB(istart+i);
777  }
778  Lcol[j+1] = lastl;
779 
780  ++upper;
781  } /* for j ... */
782 
783  } /* for k ... */
784 
785  // squeeze the matrices :
786  m_l.resizeNonZeros(lastl);
787  m_u.resizeNonZeros(lastu);
788 
789  m_extractedDataAreDirty = false;
790  }
791 }
#define eigen_assert(x)
Definition: Macros.h:902
const Scalar * valuePtr() const
Definition: SparseMatrix.h:177
void resize(Index rows, Index cols)
Definition: SparseMatrix.h:739
Index rows() const
Definition: SparseMatrix.h:165
void resizeNonZeros(Index size)
Definition: SparseMatrix.h:758
const StorageIndex * outerIndexPtr() const
Definition: SparseMatrix.h:195
const StorageIndex * innerIndexPtr() const
Definition: SparseMatrix.h:186
MatrixType::Scalar Scalar
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:82
std::ptrdiff_t j

◆ info()

template<typename MatrixType_ , typename Derived >
ComputationInfo Eigen::SuperLUBase< MatrixType_, Derived >::info ( ) const
inline

Reports whether previous computation was successful.

Returns
Success if computation was successful, NumericalIssue if the matrix.appears to be negative.

Definition at line 360 of file SuperLUSupport.h.

361  {
362  eigen_assert(m_isInitialized && "Decomposition is not initialized.");
363  return m_info;
364  }

◆ init()

template<typename MatrixType_ , typename Derived >
void Eigen::SuperLUBase< MatrixType_, Derived >::init ( )
inlineprotected

Definition at line 422 of file SuperLUSupport.h.

423  {
425  m_isInitialized = false;
426  m_sluL.Store = 0;
427  m_sluU.Store = 0;
428  }
@ InvalidInput
Definition: Constants.h:453

◆ initFactorization()

template<typename MatrixType_ , typename Derived >
void Eigen::SuperLUBase< MatrixType_, Derived >::initFactorization ( const MatrixType a)
inlineprotected

Definition at line 393 of file SuperLUSupport.h.

394  {
395  set_default_options(&this->m_sluOptions);
396 
397  const Index size = a.rows();
398  m_matrix = a;
399 
401  clearFactors();
402 
403  m_p.resize(size);
404  m_q.resize(size);
407  m_sluEtree.resize(size);
408 
409  // set empty B and X
410  m_sluB.setStorageType(SLU_DN);
412  m_sluB.Mtype = SLU_GE;
413  m_sluB.storage.values = 0;
414  m_sluB.nrow = 0;
415  m_sluB.ncol = 0;
416  m_sluB.storage.lda = internal::convert_index<int>(size);
417  m_sluX = m_sluB;
418 
420  }
constexpr void resize(Index rows, Index cols)
std::vector< int > m_sluEtree
Matrix< RealScalar, Dynamic, 1 > m_sluRscale
IntRowVectorType m_q
Matrix< RealScalar, Dynamic, 1 > m_sluCscale
IntColVectorType m_p
superlu_options_t m_sluOptions
SluMatrix asSluMatrix(MatrixType &mat)
void setStorageType(Stype_t t)
struct Eigen::SluMatrix::@838 storage

◆ options()

template<typename MatrixType_ , typename Derived >
superlu_options_t& Eigen::SuperLUBase< MatrixType_, Derived >::options ( )
inline
Returns
a reference to the Super LU option object to configure the Super LU algorithms.

Definition at line 353 of file SuperLUSupport.h.

353 { return m_sluOptions; }

◆ rows()

template<typename MatrixType_ , typename Derived >
Index Eigen::SuperLUBase< MatrixType_, Derived >::rows ( void  ) const
inline

Definition at line 349 of file SuperLUSupport.h.

349 { return m_matrix.rows(); }

Member Data Documentation

◆ m_analysisIsOk

template<typename MatrixType_ , typename Derived >
int Eigen::SuperLUBase< MatrixType_, Derived >::m_analysisIsOk
protected

Definition at line 465 of file SuperLUSupport.h.

◆ m_extractedDataAreDirty

template<typename MatrixType_ , typename Derived >
bool Eigen::SuperLUBase< MatrixType_, Derived >::m_extractedDataAreDirty
mutableprotected

Definition at line 466 of file SuperLUSupport.h.

◆ m_factorizationIsOk

template<typename MatrixType_ , typename Derived >
int Eigen::SuperLUBase< MatrixType_, Derived >::m_factorizationIsOk
protected

Definition at line 464 of file SuperLUSupport.h.

◆ m_info

template<typename MatrixType_ , typename Derived >
ComputationInfo Eigen::SuperLUBase< MatrixType_, Derived >::m_info
mutableprotected

Definition at line 463 of file SuperLUSupport.h.

◆ m_isInitialized

template<typename MatrixType_ , typename Derived >
bool Eigen::SparseSolverBase< Derived >::m_isInitialized
mutableprotected

Definition at line 123 of file SparseSolverBase.h.

◆ m_l

template<typename MatrixType_ , typename Derived >
LUMatrixType Eigen::SuperLUBase< MatrixType_, Derived >::m_l
mutableprotected

Definition at line 447 of file SuperLUSupport.h.

◆ m_matrix

template<typename MatrixType_ , typename Derived >
LUMatrixType Eigen::SuperLUBase< MatrixType_, Derived >::m_matrix
mutableprotected

Definition at line 452 of file SuperLUSupport.h.

◆ m_p

template<typename MatrixType_ , typename Derived >
IntColVectorType Eigen::SuperLUBase< MatrixType_, Derived >::m_p
mutableprotected

Definition at line 449 of file SuperLUSupport.h.

◆ m_q

template<typename MatrixType_ , typename Derived >
IntRowVectorType Eigen::SuperLUBase< MatrixType_, Derived >::m_q
mutableprotected

Definition at line 450 of file SuperLUSupport.h.

◆ m_sluA

template<typename MatrixType_ , typename Derived >
SluMatrix Eigen::SuperLUBase< MatrixType_, Derived >::m_sluA
mutableprotected

Definition at line 453 of file SuperLUSupport.h.

◆ m_sluB

template<typename MatrixType_ , typename Derived >
SluMatrix Eigen::SuperLUBase< MatrixType_, Derived >::m_sluB
mutableprotected

Definition at line 455 of file SuperLUSupport.h.

◆ m_sluBerr

template<typename MatrixType_ , typename Derived >
Matrix<RealScalar,Dynamic,1> Eigen::SuperLUBase< MatrixType_, Derived >::m_sluBerr
protected

Definition at line 460 of file SuperLUSupport.h.

◆ m_sluCscale

template<typename MatrixType_ , typename Derived >
Matrix<RealScalar,Dynamic,1> Eigen::SuperLUBase< MatrixType_, Derived >::m_sluCscale
protected

Definition at line 459 of file SuperLUSupport.h.

◆ m_sluEqued

template<typename MatrixType_ , typename Derived >
char Eigen::SuperLUBase< MatrixType_, Derived >::m_sluEqued
mutableprotected

Definition at line 461 of file SuperLUSupport.h.

◆ m_sluEtree

template<typename MatrixType_ , typename Derived >
std::vector<int> Eigen::SuperLUBase< MatrixType_, Derived >::m_sluEtree
mutableprotected

Definition at line 458 of file SuperLUSupport.h.

◆ m_sluFerr

template<typename MatrixType_ , typename Derived >
Matrix<RealScalar,Dynamic,1> Eigen::SuperLUBase< MatrixType_, Derived >::m_sluFerr
mutableprotected

Definition at line 460 of file SuperLUSupport.h.

◆ m_sluL

template<typename MatrixType_ , typename Derived >
SuperMatrix Eigen::SuperLUBase< MatrixType_, Derived >::m_sluL
mutableprotected

Definition at line 454 of file SuperLUSupport.h.

◆ m_sluOptions

template<typename MatrixType_ , typename Derived >
superlu_options_t Eigen::SuperLUBase< MatrixType_, Derived >::m_sluOptions
mutableprotected

Definition at line 457 of file SuperLUSupport.h.

◆ m_sluRscale

template<typename MatrixType_ , typename Derived >
Matrix<RealScalar,Dynamic,1> Eigen::SuperLUBase< MatrixType_, Derived >::m_sluRscale
mutableprotected

Definition at line 459 of file SuperLUSupport.h.

◆ m_sluStat

template<typename MatrixType_ , typename Derived >
SuperLUStat_t Eigen::SuperLUBase< MatrixType_, Derived >::m_sluStat
mutableprotected

Definition at line 456 of file SuperLUSupport.h.

◆ m_sluU

template<typename MatrixType_ , typename Derived >
SuperMatrix Eigen::SuperLUBase< MatrixType_, Derived >::m_sluU
protected

Definition at line 454 of file SuperLUSupport.h.

◆ m_sluX

template<typename MatrixType_ , typename Derived >
SluMatrix Eigen::SuperLUBase< MatrixType_, Derived >::m_sluX
protected

Definition at line 455 of file SuperLUSupport.h.

◆ m_u

template<typename MatrixType_ , typename Derived >
LUMatrixType Eigen::SuperLUBase< MatrixType_, Derived >::m_u
mutableprotected

Definition at line 448 of file SuperLUSupport.h.


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