Eigen::SimplicialCholesky< MatrixType_, UpLo_, Ordering_ > Class Template Reference

#include <SimplicialCholesky.h>

+ Inheritance diagram for Eigen::SimplicialCholesky< MatrixType_, UpLo_, Ordering_ >:

Public Types

enum  { UpLo = UpLo_ }
 
typedef MatrixType_ MatrixType
 
typedef SimplicialCholeskyBase< SimplicialCholeskyBase
 
typedef MatrixType::Scalar Scalar
 
typedef MatrixType::RealScalar RealScalar
 
typedef MatrixType::StorageIndex StorageIndex
 
typedef SparseMatrix< Scalar, ColMajor, StorageIndexCholMatrixType
 
typedef Matrix< Scalar, Dynamic, 1 > VectorType
 
typedef internal::traits< SimplicialLDLT< MatrixType, UpLo > > LDLTTraits
 
typedef internal::traits< SimplicialLLT< MatrixType, UpLo > > LLTTraits
 
- Public Types inherited from Eigen::SimplicialCholeskyBase< SimplicialCholesky< MatrixType_, UpLo_, Ordering_ > >
enum  
 
enum  
 
typedef internal::traits< SimplicialCholesky< MatrixType_, UpLo_, Ordering_ > >::MatrixType MatrixType
 
typedef internal::traits< SimplicialCholesky< MatrixType_, UpLo_, Ordering_ > >::OrderingType OrderingType
 
typedef MatrixType::Scalar Scalar
 
typedef MatrixType::RealScalar RealScalar
 
typedef internal::traits< SimplicialCholesky< MatrixType_, UpLo_, Ordering_ > >::DiagonalScalar DiagonalScalar
 
typedef MatrixType::StorageIndex StorageIndex
 
typedef SparseMatrix< Scalar, ColMajor, StorageIndexCholMatrixType
 
typedef CholMatrixType const * ConstCholMatrixPtr
 
typedef Matrix< Scalar, Dynamic, 1 > VectorType
 
typedef Matrix< StorageIndex, Dynamic, 1 > VectorI
 

Public Member Functions

 SimplicialCholesky ()
 
 SimplicialCholesky (const MatrixType &matrix)
 
SimplicialCholeskysetMode (SimplicialCholeskyMode mode)
 
const VectorType vectorD () const
 
const CholMatrixType rawMatrix () const
 
SimplicialCholeskycompute (const MatrixType &matrix)
 
void analyzePattern (const MatrixType &a)
 
void factorize (const MatrixType &a)
 
template<typename Rhs , typename Dest >
void _solve_impl (const MatrixBase< Rhs > &b, MatrixBase< Dest > &dest) const
 
template<typename Rhs , typename Dest >
void _solve_impl (const SparseMatrixBase< Rhs > &b, SparseMatrixBase< Dest > &dest) const
 
Scalar determinant () const
 
- Public Member Functions inherited from Eigen::SimplicialCholeskyBase< SimplicialCholesky< MatrixType_, UpLo_, Ordering_ > >
 SimplicialCholeskyBase ()
 
 SimplicialCholeskyBase (const MatrixType &matrix)
 
 ~SimplicialCholeskyBase ()
 
SimplicialCholesky< MatrixType_, UpLo_, Ordering_ > & derived ()
 
const SimplicialCholesky< MatrixType_, UpLo_, Ordering_ > & derived () const
 
SimplicialCholesky< MatrixType_, UpLo_, Ordering_ > & derived ()
 
const SimplicialCholesky< MatrixType_, UpLo_, Ordering_ > & derived () const
 
Index cols () const
 
Index rows () const
 
ComputationInfo info () const
 Reports whether previous computation was successful. More...
 
const PermutationMatrix< Dynamic, Dynamic, StorageIndex > & permutationP () const
 
const PermutationMatrix< Dynamic, Dynamic, StorageIndex > & permutationPinv () const
 
SimplicialCholesky< MatrixType_, UpLo_, Ordering_ > & setShift (const DiagonalScalar &offset, const DiagonalScalar &scale=1)
 
void dumpMemory (Stream &s)
 
void _solve_impl (const MatrixBase< Rhs > &b, MatrixBase< Dest > &dest) const
 
void _solve_impl (const SparseMatrixBase< Rhs > &b, SparseMatrixBase< Dest > &dest) const
 
- Public Member Functions inherited from Eigen::SparseSolverBase< SimplicialCholesky< MatrixType_, UpLo_, Ordering_ > >
 SparseSolverBase ()
 
 SparseSolverBase (SparseSolverBase &&other)
 
 ~SparseSolverBase ()
 
SimplicialCholesky< MatrixType_, UpLo_, Ordering_ > & derived ()
 
const SimplicialCholesky< MatrixType_, UpLo_, Ordering_ > & derived () const
 
const Solve< SimplicialCholesky< MatrixType_, UpLo_, Ordering_ >, Rhs > solve (const MatrixBase< Rhs > &b) const
 
const Solve< SimplicialCholesky< MatrixType_, UpLo_, Ordering_ >, Rhs > solve (const SparseMatrixBase< Rhs > &b) const
 
void _solve_impl (const SparseMatrixBase< Rhs > &b, SparseMatrixBase< Dest > &dest) const
 

Protected Attributes

bool m_LDLT
 
- Protected Attributes inherited from Eigen::SimplicialCholeskyBase< SimplicialCholesky< MatrixType_, UpLo_, Ordering_ > >
ComputationInfo m_info
 
bool m_factorizationIsOk
 
bool m_analysisIsOk
 
CholMatrixType m_matrix
 
VectorType m_diag
 
VectorI m_parent
 
VectorI m_workSpace
 
PermutationMatrix< Dynamic, Dynamic, StorageIndexm_P
 
PermutationMatrix< Dynamic, Dynamic, StorageIndexm_Pinv
 
DiagonalScalar m_shiftOffset
 
DiagonalScalar m_shiftScale
 
- Protected Attributes inherited from Eigen::SparseSolverBase< SimplicialCholesky< MatrixType_, UpLo_, Ordering_ > >
bool m_isInitialized
 

Additional Inherited Members

- Protected Member Functions inherited from Eigen::SimplicialCholeskyBase< SimplicialCholesky< MatrixType_, UpLo_, Ordering_ > >
void compute (const MatrixType &matrix)
 
void factorize (const MatrixType &a)
 
void factorize_preordered (const CholMatrixType &a)
 
void analyzePattern (const MatrixType &a)
 
void analyzePattern_preordered (const CholMatrixType &a, bool doLDLT)
 
void ordering (const MatrixType &a, ConstCholMatrixPtr &pmat, CholMatrixType &ap)
 
DiagonalScalar getDiag (Scalar x)
 
Scalar getSymm (Scalar x)
 

Detailed Description

template<typename MatrixType_, int UpLo_, typename Ordering_>
class Eigen::SimplicialCholesky< MatrixType_, UpLo_, Ordering_ >

Deprecated:
use SimplicialLDLT or class SimplicialLLT
See also
class SimplicialLDLT, class SimplicialLLT

Member Typedef Documentation

◆ Base

template<typename MatrixType_ , int UpLo_, typename Ordering_ >
typedef SimplicialCholeskyBase<SimplicialCholesky> Eigen::SimplicialCholesky< MatrixType_, UpLo_, Ordering_ >::Base

◆ CholMatrixType

template<typename MatrixType_ , int UpLo_, typename Ordering_ >
typedef SparseMatrix<Scalar, ColMajor, StorageIndex> Eigen::SimplicialCholesky< MatrixType_, UpLo_, Ordering_ >::CholMatrixType

◆ LDLTTraits

template<typename MatrixType_ , int UpLo_, typename Ordering_ >
typedef internal::traits<SimplicialLDLT<MatrixType, UpLo> > Eigen::SimplicialCholesky< MatrixType_, UpLo_, Ordering_ >::LDLTTraits

◆ LLTTraits

template<typename MatrixType_ , int UpLo_, typename Ordering_ >
typedef internal::traits<SimplicialLLT<MatrixType, UpLo> > Eigen::SimplicialCholesky< MatrixType_, UpLo_, Ordering_ >::LLTTraits

◆ MatrixType

template<typename MatrixType_ , int UpLo_, typename Ordering_ >
typedef MatrixType_ Eigen::SimplicialCholesky< MatrixType_, UpLo_, Ordering_ >::MatrixType

◆ RealScalar

template<typename MatrixType_ , int UpLo_, typename Ordering_ >
typedef MatrixType::RealScalar Eigen::SimplicialCholesky< MatrixType_, UpLo_, Ordering_ >::RealScalar

◆ Scalar

template<typename MatrixType_ , int UpLo_, typename Ordering_ >
typedef MatrixType::Scalar Eigen::SimplicialCholesky< MatrixType_, UpLo_, Ordering_ >::Scalar

◆ StorageIndex

template<typename MatrixType_ , int UpLo_, typename Ordering_ >
typedef MatrixType::StorageIndex Eigen::SimplicialCholesky< MatrixType_, UpLo_, Ordering_ >::StorageIndex

◆ VectorType

template<typename MatrixType_ , int UpLo_, typename Ordering_ >
typedef Matrix<Scalar, Dynamic, 1> Eigen::SimplicialCholesky< MatrixType_, UpLo_, Ordering_ >::VectorType

Member Enumeration Documentation

◆ anonymous enum

template<typename MatrixType_ , int UpLo_, typename Ordering_ >
anonymous enum
Enumerator
UpLo 
697 { UpLo = UpLo_ };
@ UpLo
Definition: SimplicialCholesky.h:697

Constructor & Destructor Documentation

◆ SimplicialCholesky() [1/2]

template<typename MatrixType_ , int UpLo_, typename Ordering_ >
Eigen::SimplicialCholesky< MatrixType_, UpLo_, Ordering_ >::SimplicialCholesky ( )
inline
708 : Base(), m_LDLT(true) {}
bool m_LDLT
Definition: SimplicialCholesky.h:823
SimplicialCholeskyBase< SimplicialCholesky > Base
Definition: SimplicialCholesky.h:698

◆ SimplicialCholesky() [2/2]

template<typename MatrixType_ , int UpLo_, typename Ordering_ >
Eigen::SimplicialCholesky< MatrixType_, UpLo_, Ordering_ >::SimplicialCholesky ( const MatrixType matrix)
inlineexplicit
710 : Base(), m_LDLT(true) { compute(matrix); }
SimplicialCholesky & compute(const MatrixType &matrix)
Definition: SimplicialCholesky.h:737
Eigen::Map< Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor >, 0, Eigen::OuterStride<> > matrix(T *data, int rows, int cols, int stride)
Definition: common.h:85

References Eigen::SimplicialCholesky< MatrixType_, UpLo_, Ordering_ >::compute(), and matrix().

Member Function Documentation

◆ _solve_impl() [1/2]

template<typename MatrixType_ , int UpLo_, typename Ordering_ >
template<typename Rhs , typename Dest >
void Eigen::SimplicialCholesky< MatrixType_, UpLo_, Ordering_ >::_solve_impl ( const MatrixBase< Rhs > &  b,
MatrixBase< Dest > &  dest 
) const
inline
773  {
775  "The decomposition is not in a valid state for solving, you must first call either compute() or "
776  "symbolic()/numeric()");
777  eigen_assert(Base::m_matrix.rows() == b.rows());
778 
779  if (Base::m_info != Success) return;
780 
781  if (Base::m_P.size() > 0)
782  dest = Base::m_P * b;
783  else
784  dest = b;
785 
786  if (Base::m_matrix.nonZeros() > 0) // otherwise L==I
787  {
788  if (m_LDLT)
789  LDLTTraits::getL(Base::m_matrix).solveInPlace(dest);
790  else
791  LLTTraits::getL(Base::m_matrix).solveInPlace(dest);
792  }
793 
794  if (Base::m_diag.size() > 0) dest = Base::m_diag.real().asDiagonal().inverse() * dest;
795 
796  if (Base::m_matrix.nonZeros() > 0) // otherwise I==I
797  {
798  if (m_LDLT)
799  LDLTTraits::getU(Base::m_matrix).solveInPlace(dest);
800  else
801  LLTTraits::getU(Base::m_matrix).solveInPlace(dest);
802  }
803 
804  if (Base::m_P.size() > 0) dest = Base::m_Pinv * dest;
805  }
#define eigen_assert(x)
Definition: Macros.h:910
Scalar Scalar int size
Definition: benchVecAdd.cpp:17
Scalar * b
Definition: benchVecAdd.cpp:17
CholMatrixType m_matrix
Definition: SimplicialCholesky.h:240
VectorType m_diag
Definition: SimplicialCholesky.h:241
bool m_factorizationIsOk
Definition: SimplicialCholesky.h:237
ComputationInfo m_info
Definition: SimplicialCholesky.h:236
PermutationMatrix< Dynamic, Dynamic, StorageIndex > m_Pinv
Definition: SimplicialCholesky.h:245
PermutationMatrix< Dynamic, Dynamic, StorageIndex > m_P
Definition: SimplicialCholesky.h:244
@ Success
Definition: Constants.h:440

References b, eigen_assert, Eigen::SimplicialCholeskyBase< Derived >::m_diag, Eigen::SimplicialCholeskyBase< Derived >::m_factorizationIsOk, Eigen::SimplicialCholeskyBase< Derived >::m_info, Eigen::SimplicialCholesky< MatrixType_, UpLo_, Ordering_ >::m_LDLT, Eigen::SimplicialCholeskyBase< Derived >::m_matrix, Eigen::SimplicialCholeskyBase< Derived >::m_P, Eigen::SimplicialCholeskyBase< Derived >::m_Pinv, Eigen::SimplicialCholeskyBase< SimplicialCholesky< MatrixType_, UpLo_, Ordering_ > >::rows(), size, and Eigen::Success.

◆ _solve_impl() [2/2]

template<typename MatrixType_ , int UpLo_, typename Ordering_ >
template<typename Rhs , typename Dest >
void Eigen::SimplicialCholesky< MatrixType_, UpLo_, Ordering_ >::_solve_impl ( const SparseMatrixBase< Rhs > &  b,
SparseMatrixBase< Dest > &  dest 
) const
inline
809  {
811  }
std::enable_if_t< Rhs::ColsAtCompileTime !=1 &&Dest::ColsAtCompileTime !=1 > solve_sparse_through_dense_panels(const Decomposition &dec, const Rhs &rhs, Dest &dest)
Definition: SparseSolverBase.h:25

References b, and Eigen::internal::solve_sparse_through_dense_panels().

◆ analyzePattern()

template<typename MatrixType_ , int UpLo_, typename Ordering_ >
void Eigen::SimplicialCholesky< MatrixType_, UpLo_, Ordering_ >::analyzePattern ( const MatrixType a)
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()
751  {
752  if (m_LDLT)
753  Base::template analyzePattern<true, false>(a);
754  else
755  Base::template analyzePattern<false, false>(a);
756  }
const Scalar * a
Definition: level2_cplx_impl.h:32

References a, and Eigen::SimplicialCholesky< MatrixType_, UpLo_, Ordering_ >::m_LDLT.

◆ compute()

template<typename MatrixType_ , int UpLo_, typename Ordering_ >
SimplicialCholesky& Eigen::SimplicialCholesky< MatrixType_, UpLo_, Ordering_ >::compute ( const MatrixType matrix)
inline

Computes the sparse Cholesky decomposition of matrix

737  {
738  if (m_LDLT)
739  Base::template compute<true, false>(matrix);
740  else
741  Base::template compute<false, false>(matrix);
742  return *this;
743  }

References Eigen::SimplicialCholesky< MatrixType_, UpLo_, Ordering_ >::m_LDLT, and matrix().

Referenced by Eigen::SimplicialCholesky< MatrixType_, UpLo_, Ordering_ >::SimplicialCholesky().

◆ determinant()

template<typename MatrixType_ , int UpLo_, typename Ordering_ >
Scalar Eigen::SimplicialCholesky< MatrixType_, UpLo_, Ordering_ >::determinant ( ) const
inline
813  {
814  if (m_LDLT) {
815  return Base::m_diag.prod();
816  } else {
817  Scalar detL = Diagonal<const CholMatrixType>(Base::m_matrix).prod();
818  return numext::abs2(detL);
819  }
820  }
SCALAR Scalar
Definition: bench_gemm.cpp:45
EIGEN_DEVICE_FUNC bool abs2(bool x)
Definition: MathFunctions.h:1102

References Eigen::numext::abs2(), Eigen::SimplicialCholeskyBase< Derived >::m_diag, Eigen::SimplicialCholesky< MatrixType_, UpLo_, Ordering_ >::m_LDLT, and Eigen::SimplicialCholeskyBase< Derived >::m_matrix.

◆ factorize()

template<typename MatrixType_ , int UpLo_, typename Ordering_ >
void Eigen::SimplicialCholesky< MatrixType_, UpLo_, Ordering_ >::factorize ( const MatrixType a)
inline

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()
764  {
765  if (m_LDLT)
766  Base::template factorize<true, false>(a);
767  else
768  Base::template factorize<false, false>(a);
769  }

References a, and Eigen::SimplicialCholesky< MatrixType_, UpLo_, Ordering_ >::m_LDLT.

◆ rawMatrix()

template<typename MatrixType_ , int UpLo_, typename Ordering_ >
const CholMatrixType Eigen::SimplicialCholesky< MatrixType_, UpLo_, Ordering_ >::rawMatrix ( ) const
inline

◆ setMode()

template<typename MatrixType_ , int UpLo_, typename Ordering_ >
SimplicialCholesky& Eigen::SimplicialCholesky< MatrixType_, UpLo_, Ordering_ >::setMode ( SimplicialCholeskyMode  mode)
inline
712  {
713  switch (mode) {
715  m_LDLT = false;
716  break;
718  m_LDLT = true;
719  break;
720  default:
721  break;
722  }
723 
724  return *this;
725  }
@ SimplicialCholeskyLDLT
Definition: SimplicialCholesky.h:18
@ SimplicialCholeskyLLT
Definition: SimplicialCholesky.h:18

References Eigen::SimplicialCholesky< MatrixType_, UpLo_, Ordering_ >::m_LDLT, Eigen::SimplicialCholeskyLDLT, and Eigen::SimplicialCholeskyLLT.

◆ vectorD()

template<typename MatrixType_ , int UpLo_, typename Ordering_ >
const VectorType Eigen::SimplicialCholesky< MatrixType_, UpLo_, Ordering_ >::vectorD ( ) const
inline

Member Data Documentation

◆ m_LDLT


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