Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Eigen::SimplicialCholesky< _MatrixType, _UpLo, _Ordering > Class Template Reference

#include <src/eigen/Eigen/src/SparseCholesky/SimplicialCholesky.h>

+ Inheritance diagram for Eigen::SimplicialCholesky< _MatrixType, _UpLo, _Ordering >:
+ Collaboration 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< SimplicialCholeskyTraits
 
typedef internal::traits< SimplicialLDLT< MatrixType, UpLo > > LDLTTraits
 
typedef internal::traits< SimplicialLLT< MatrixType, UpLo > > LLTTraits
 
enum  
 
enum  
 
typedef internal::traits< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::OrderingType OrderingType
 
typedef CholMatrixType constConstCholMatrixPtr
 
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
 
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.
 
const PermutationMatrix< Dynamic, Dynamic, StorageIndex > & permutationP () const
 
const PermutationMatrix< Dynamic, Dynamic, StorageIndex > & permutationPinv () const
 
SimplicialCholesky< _MatrixType, _UpLo, _Ordering > & setShift (const RealScalar &offset, const RealScalar &scale=1)
 
void dumpMemory (Stream &s)
 
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 Member Functions

void compute (const MatrixType &matrix)
 
void factorize (const MatrixType &a)
 
void factorize_preordered (const CholMatrixType &a)
 
void analyzePattern (const MatrixType &a, bool doLDLT)
 
void analyzePattern_preordered (const CholMatrixType &a, bool doLDLT)
 
void ordering (const MatrixType &a, ConstCholMatrixPtr &pmat, CholMatrixType &ap)
 

Protected Attributes

bool m_LDLT
 
ComputationInfo m_info
 
bool m_factorizationIsOk
 
bool m_analysisIsOk
 
CholMatrixType m_matrix
 
VectorType m_diag
 
VectorI m_parent
 
VectorI m_nonZerosPerCol
 
PermutationMatrix< Dynamic, Dynamic, StorageIndexm_P
 
PermutationMatrix< Dynamic, Dynamic, StorageIndexm_Pinv
 
RealScalar m_shiftOffset
 
RealScalar m_shiftScale
 

Private Attributes

bool m_isInitialized
 

Detailed Description

template<typename _MatrixType, int _UpLo, typename _Ordering>
class Eigen::SimplicialCholesky< _MatrixType, _UpLo, _Ordering >
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

◆ ConstCholMatrixPtr

typedef CholMatrixType const* Eigen::SimplicialCholeskyBase< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::ConstCholMatrixPtr
inherited

◆ 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

◆ OrderingType

typedef internal::traits<SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::OrderingType Eigen::SimplicialCholeskyBase< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::OrderingType
inherited

◆ 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

◆ Traits

template<typename _MatrixType , int _UpLo, typename _Ordering >
typedef internal::traits<SimplicialCholesky> Eigen::SimplicialCholesky< _MatrixType, _UpLo, _Ordering >::Traits

◆ VectorI

typedef Matrix<StorageIndex,Dynamic,1> Eigen::SimplicialCholeskyBase< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::VectorI
inherited

◆ VectorType

template<typename _MatrixType , int _UpLo, typename _Ordering >
typedef Matrix<Scalar,Dynamic,1> Eigen::SimplicialCholesky< _MatrixType, _UpLo, _Ordering >::VectorType

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
inherited
63{ UpLo = internal::traits<Derived>::UpLo };

◆ anonymous enum

anonymous enum
inherited
72 {
73 ColsAtCompileTime = MatrixType::ColsAtCompileTime,
74 MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime
75 };

◆ anonymous enum

template<typename _MatrixType , int _UpLo, typename _Ordering >
anonymous enum
Enumerator
UpLo 
507{ UpLo = _UpLo };
@ UpLo
Definition SimplicialCholesky.h:507

Constructor & Destructor Documentation

◆ SimplicialCholesky() [1/2]

template<typename _MatrixType , int _UpLo, typename _Ordering >
Eigen::SimplicialCholesky< _MatrixType, _UpLo, _Ordering >::SimplicialCholesky ( )
inline
518: Base(), m_LDLT(true) {}
bool m_LDLT
Definition SimplicialCholesky.h:646
SimplicialCholeskyBase< SimplicialCholesky > Base
Definition SimplicialCholesky.h:508

◆ SimplicialCholesky() [2/2]

template<typename _MatrixType , int _UpLo, typename _Ordering >
Eigen::SimplicialCholesky< _MatrixType, _UpLo, _Ordering >::SimplicialCholesky ( const MatrixType matrix)
inlineexplicit
521 : Base(), m_LDLT(true)
522 {
523 compute(matrix);
524 }
SimplicialCholesky & compute(const MatrixType &matrix)
Definition SimplicialCholesky.h:553

References Eigen::SimplicialCholesky< _MatrixType, _UpLo, _Ordering >::compute().

+ Here is the call graph for this function:

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
590 {
591 eigen_assert(Base::m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or symbolic()/numeric()");
593
595 return;
596
597 if(Base::m_P.size()>0)
598 dest = Base::m_P * b;
599 else
600 dest = b;
601
602 if(Base::m_matrix.nonZeros()>0) // otherwise L==I
603 {
604 if(m_LDLT)
605 LDLTTraits::getL(Base::m_matrix).solveInPlace(dest);
606 else
607 LLTTraits::getL(Base::m_matrix).solveInPlace(dest);
608 }
609
610 if(Base::m_diag.size()>0)
611 dest = Base::m_diag.asDiagonal().inverse() * dest;
612
613 if (Base::m_matrix.nonZeros()>0) // otherwise I==I
614 {
615 if(m_LDLT)
616 LDLTTraits::getU(Base::m_matrix).solveInPlace(dest);
617 else
618 LLTTraits::getU(Base::m_matrix).solveInPlace(dest);
619 }
620
621 if(Base::m_P.size()>0)
622 dest = Base::m_Pinv * dest;
623 }
#define eigen_assert(x)
Definition Macros.h:579
PermutationMatrix< Dynamic, Dynamic, StorageIndex > m_P
Definition SimplicialCholesky.h:259
CholMatrixType m_matrix
Definition SimplicialCholesky.h:255
VectorType m_diag
Definition SimplicialCholesky.h:256
PermutationMatrix< Dynamic, Dynamic, StorageIndex > m_Pinv
Definition SimplicialCholesky.h:260
bool m_factorizationIsOk
Definition SimplicialCholesky.h:252
ComputationInfo m_info
Definition SimplicialCholesky.h:251
@ Success
Definition Constants.h:432
constexpr auto size(const C &c) -> decltype(c.size())
Definition span.hpp:183

References 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(), and Eigen::Success.

+ Here is the call graph for this function:

◆ _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
628 {
630 }
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

References Eigen::internal::solve_sparse_through_dense_panels().

+ Here is the call graph for this function:

◆ analyzePattern() [1/2]

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()
569 {
571 }
void analyzePattern(const MatrixType &a, bool doLDLT)
Definition SimplicialCholesky.h:230

References Eigen::SimplicialCholeskyBase< Derived >::analyzePattern(), and Eigen::SimplicialCholesky< _MatrixType, _UpLo, _Ordering >::m_LDLT.

+ Here is the call graph for this function:

◆ analyzePattern() [2/2]

void Eigen::SimplicialCholeskyBase< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::analyzePattern ( const MatrixType a,
bool  doLDLT 
)
inlineprotectedinherited
231 {
232 eigen_assert(a.rows()==a.cols());
233 Index size = a.cols();
234 CholMatrixType tmp(size,size);
236 ordering(a, pmat, tmp);
237 analyzePattern_preordered(*pmat,doLDLT);
238 }
CholMatrixType const * ConstCholMatrixPtr
Definition SimplicialCholesky.h:68
void analyzePattern_preordered(const CholMatrixType &a, bool doLDLT)
Definition SimplicialCholesky_impl.h:51
SparseMatrix< Scalar, ColMajor, StorageIndex > CholMatrixType
Definition SimplicialCholesky.h:67
static enum @17 ordering
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:33

◆ analyzePattern_preordered()

void Eigen::SimplicialCholeskyBase< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::analyzePattern_preordered ( const CholMatrixType a,
bool  doLDLT 
)
protectedinherited
52{
53 const StorageIndex size = StorageIndex(ap.rows());
54 m_matrix.resize(size, size);
55 m_parent.resize(size);
57
58 ei_declare_aligned_stack_constructed_variable(StorageIndex, tags, size, 0);
59
60 for(StorageIndex k = 0; k < size; ++k)
61 {
62 /* L(k,:) pattern: all nodes reachable in etree from nz in A(0:k-1,k) */
63 m_parent[k] = -1; /* parent of k is not yet known */
64 tags[k] = k; /* mark node k as visited */
65 m_nonZerosPerCol[k] = 0; /* count of nonzeros in column k of L */
66 for(typename CholMatrixType::InnerIterator it(ap,k); it; ++it)
67 {
68 StorageIndex i = it.index();
69 if(i < k)
70 {
71 /* follow path from i to root of etree, stop at flagged node */
72 for(; tags[i] != k; i = m_parent[i])
73 {
74 /* find parent of i if not yet determined */
75 if (m_parent[i] == -1)
76 m_parent[i] = k;
77 m_nonZerosPerCol[i]++; /* L (k,i) is nonzero */
78 tags[i] = k; /* mark i as visited */
79 }
80 }
81 }
82 }
83
84 /* construct Lp index array from m_nonZerosPerCol column counts */
86 Lp[0] = 0;
87 for(StorageIndex k = 0; k < size; ++k)
88 Lp[k+1] = Lp[k] + m_nonZerosPerCol[k] + (doLDLT ? 0 : 1);
89
90 m_matrix.resizeNonZeros(Lp[size]);
91
92 m_isInitialized = true;
94 m_analysisIsOk = true;
95 m_factorizationIsOk = false;
96}
#define ei_declare_aligned_stack_constructed_variable(TYPE, NAME, SIZE, BUFFER)
Definition Memory.h:644
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resize(Index rows, Index cols)
Definition PlainObjectBase.h:279
MatrixType::StorageIndex StorageIndex
Definition SimplicialCholesky.h:66
void resizeNonZeros(Index size)
Definition SparseMatrix.h:644
const StorageIndex * outerIndexPtr() const
Definition SparseMatrix.h:166
void resize(Index rows, Index cols)
Definition SparseMatrix.h:621

◆ cols()

Index Eigen::SimplicialCholeskyBase< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::cols ( ) const
inlineinherited
99{ return m_matrix.cols(); }
Index cols() const
Definition SparseMatrix.h:138

◆ compute() [1/2]

void Eigen::SimplicialCholeskyBase< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::compute ( const MatrixType matrix)
inlineprotectedinherited

Computes the sparse Cholesky decomposition of matrix

195 {
196 eigen_assert(matrix.rows()==matrix.cols());
197 Index size = matrix.cols();
198 CholMatrixType tmp(size,size);
200 ordering(matrix, pmat, tmp);
201 analyzePattern_preordered(*pmat, DoLDLT);
202 factorize_preordered<DoLDLT>(*pmat);
203 }

◆ compute() [2/2]

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

554 {
555 if(m_LDLT)
556 Base::template compute<true>(matrix);
557 else
558 Base::template compute<false>(matrix);
559 return *this;
560 }

References Eigen::SimplicialCholesky< _MatrixType, _UpLo, _Ordering >::m_LDLT.

Referenced by Eigen::SimplicialCholesky< _MatrixType, _UpLo, _Ordering >::SimplicialCholesky(), and igl::Frame_field_deformer::precompute_opt().

+ Here is the caller graph for this function:

◆ derived() [1/4]

SimplicialCholesky< _MatrixType, _UpLo, _Ordering > & Eigen::SparseSolverBase< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::derived ( )
inlineinherited
79{ return *static_cast<Derived*>(this); }

◆ derived() [2/4]

SimplicialCholesky< _MatrixType, _UpLo, _Ordering > & Eigen::SimplicialCholeskyBase< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::derived ( )
inlineinherited
96{ return *static_cast<Derived*>(this); }

◆ derived() [3/4]

const SimplicialCholesky< _MatrixType, _UpLo, _Ordering > & Eigen::SparseSolverBase< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::derived ( ) const
inlineinherited
80{ return *static_cast<const Derived*>(this); }

◆ derived() [4/4]

const SimplicialCholesky< _MatrixType, _UpLo, _Ordering > & Eigen::SimplicialCholeskyBase< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::derived ( ) const
inlineinherited
97{ return *static_cast<const Derived*>(this); }

◆ determinant()

template<typename _MatrixType , int _UpLo, typename _Ordering >
Scalar Eigen::SimplicialCholesky< _MatrixType, _UpLo, _Ordering >::determinant ( ) const
inline
633 {
634 if(m_LDLT)
635 {
636 return Base::m_diag.prod();
637 }
638 else
639 {
640 Scalar detL = Diagonal<const CholMatrixType>(Base::m_matrix).prod();
641 return numext::abs2(detL);
642 }
643 }
MatrixType::Scalar Scalar
Definition SimplicialCholesky.h:509

References Eigen::SimplicialCholeskyBase< Derived >::m_diag, Eigen::SimplicialCholesky< _MatrixType, _UpLo, _Ordering >::m_LDLT, and Eigen::SimplicialCholeskyBase< Derived >::m_matrix.

◆ dumpMemory()

void Eigen::SimplicialCholeskyBase< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::dumpMemory ( Stream &  s)
inlineinherited
143 {
144 int total = 0;
145 s << " L: " << ((total+=(m_matrix.cols()+1) * sizeof(int) + m_matrix.nonZeros()*(sizeof(int)+sizeof(Scalar))) >> 20) << "Mb" << "\n";
146 s << " diag: " << ((total+=m_diag.size() * sizeof(Scalar)) >> 20) << "Mb" << "\n";
147 s << " tree: " << ((total+=m_parent.size() * sizeof(int)) >> 20) << "Mb" << "\n";
148 s << " nonzeros: " << ((total+=m_nonZerosPerCol.size() * sizeof(int)) >> 20) << "Mb" << "\n";
149 s << " perm: " << ((total+=m_P.size() * sizeof(int)) >> 20) << "Mb" << "\n";
150 s << " perm^-1: " << ((total+=m_Pinv.size() * sizeof(int)) >> 20) << "Mb" << "\n";
151 s << " TOTAL: " << (total>> 20) << "Mb" << "\n";
152 }
Index size() const
Definition PermutationMatrix.h:108
Index nonZeros() const
Definition SparseCompressedBase.h:56

◆ factorize() [1/2]

void Eigen::SimplicialCholeskyBase< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::factorize ( const MatrixType a)
inlineprotectedinherited
207 {
208 eigen_assert(a.rows()==a.cols());
209 Index size = a.cols();
210 CholMatrixType tmp(size,size);
212
213 if(m_P.size()==0 && (UpLo&Upper)==Upper)
214 {
215 // If there is no ordering, try to directly use the input matrix without any copy
216 internal::simplicial_cholesky_grab_input<CholMatrixType,MatrixType>::run(a, pmat, tmp);
217 }
218 else
219 {
220 tmp.template selfadjointView<Upper>() = a.template selfadjointView<UpLo>().twistedBy(m_P);
221 pmat = &tmp;
222 }
223
224 factorize_preordered<DoLDLT>(*pmat);
225 }

◆ factorize() [2/2]

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()
580 {
581 if(m_LDLT)
582 Base::template factorize<true>(a);
583 else
584 Base::template factorize<false>(a);
585 }

References Eigen::SimplicialCholesky< _MatrixType, _UpLo, _Ordering >::m_LDLT.

◆ factorize_preordered()

void Eigen::SimplicialCholeskyBase< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::factorize_preordered ( const CholMatrixType a)
protectedinherited
102{
103 using std::sqrt;
104
105 eigen_assert(m_analysisIsOk && "You must first call analyzePattern()");
106 eigen_assert(ap.rows()==ap.cols());
107 eigen_assert(m_parent.size()==ap.rows());
108 eigen_assert(m_nonZerosPerCol.size()==ap.rows());
109
110 const StorageIndex size = StorageIndex(ap.rows());
111 const StorageIndex* Lp = m_matrix.outerIndexPtr();
113 Scalar* Lx = m_matrix.valuePtr();
114
116 ei_declare_aligned_stack_constructed_variable(StorageIndex, pattern, size, 0);
117 ei_declare_aligned_stack_constructed_variable(StorageIndex, tags, size, 0);
118
119 bool ok = true;
120 m_diag.resize(DoLDLT ? size : 0);
121
122 for(StorageIndex k = 0; k < size; ++k)
123 {
124 // compute nonzero pattern of kth row of L, in topological order
125 y[k] = 0.0; // Y(0:k) is now all zero
126 StorageIndex top = size; // stack for pattern is empty
127 tags[k] = k; // mark node k as visited
128 m_nonZerosPerCol[k] = 0; // count of nonzeros in column k of L
129 for(typename CholMatrixType::InnerIterator it(ap,k); it; ++it)
130 {
131 StorageIndex i = it.index();
132 if(i <= k)
133 {
134 y[i] += numext::conj(it.value()); /* scatter A(i,k) into Y (sum duplicates) */
135 Index len;
136 for(len = 0; tags[i] != k; i = m_parent[i])
137 {
138 pattern[len++] = i; /* L(k,i) is nonzero */
139 tags[i] = k; /* mark i as visited */
140 }
141 while(len > 0)
142 pattern[--top] = pattern[--len];
143 }
144 }
145
146 /* compute numerical values kth row of L (a sparse triangular solve) */
147
148 RealScalar d = numext::real(y[k]) * m_shiftScale + m_shiftOffset; // get D(k,k), apply the shift function, and clear Y(k)
149 y[k] = 0.0;
150 for(; top < size; ++top)
151 {
152 Index i = pattern[top]; /* pattern[top:n-1] is pattern of L(:,k) */
153 Scalar yi = y[i]; /* get and clear Y(i) */
154 y[i] = 0.0;
155
156 /* the nonzero entry L(k,i) */
157 Scalar l_ki;
158 if(DoLDLT)
159 l_ki = yi / m_diag[i];
160 else
161 yi = l_ki = yi / Lx[Lp[i]];
162
163 Index p2 = Lp[i] + m_nonZerosPerCol[i];
164 Index p;
165 for(p = Lp[i] + (DoLDLT ? 0 : 1); p < p2; ++p)
166 y[Li[p]] -= numext::conj(Lx[p]) * yi;
167 d -= numext::real(l_ki * numext::conj(yi));
168 Li[p] = k; /* store L(k,i) in column form of L */
169 Lx[p] = l_ki;
170 ++m_nonZerosPerCol[i]; /* increment count of nonzeros in col i */
171 }
172 if(DoLDLT)
173 {
174 m_diag[k] = d;
175 if(d == RealScalar(0))
176 {
177 ok = false; /* failure, D(k,k) is zero */
178 break;
179 }
180 }
181 else
182 {
183 Index p = Lp[k] + m_nonZerosPerCol[k]++;
184 Li[p] = k ; /* store L(k,k) = sqrt (d) in column k */
185 if(d <= RealScalar(0)) {
186 ok = false; /* failure, matrix is not positive definite */
187 break;
188 }
189 Lx[p] = sqrt(d) ;
190 }
191 }
192
194 m_factorizationIsOk = true;
195}
EIGEN_DEVICE_FUNC const SqrtReturnType sqrt() const
Definition ArrayCwiseUnaryOps.h:152
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index rows() const
Definition PlainObjectBase.h:151
MatrixType::RealScalar RealScalar
Definition SimplicialCholesky.h:65
const StorageIndex * innerIndexPtr() const
Definition SparseMatrix.h:157
const Scalar * valuePtr() const
Definition SparseMatrix.h:148
@ NumericalIssue
Definition Constants.h:434
const Scalar & y
Definition MathFunctions.h:552

◆ info()

ComputationInfo Eigen::SimplicialCholeskyBase< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::info ( ) const
inlineinherited

Reports whether previous computation was successful.

Returns
Success if computation was succesful, NumericalIssue if the matrix.appears to be negative.
108 {
109 eigen_assert(m_isInitialized && "Decomposition is not initialized.");
110 return m_info;
111 }

◆ ordering()

void Eigen::SimplicialCholeskyBase< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::ordering ( const MatrixType a,
ConstCholMatrixPtr pmat,
CholMatrixType ap 
)
protectedinherited
651{
652 eigen_assert(a.rows()==a.cols());
653 const Index size = a.rows();
654 pmat = &ap;
655 // Note that ordering methods compute the inverse permutation
656 if(!internal::is_same<OrderingType,NaturalOrdering<Index> >::value)
657 {
658 {
660 C = a.template selfadjointView<UpLo>();
661
663 ordering(C,m_Pinv);
664 }
665
666 if(m_Pinv.size()>0) m_P = m_Pinv.inverse();
667 else m_P.resize(0);
668
669 ap.resize(size,size);
670 ap.template selfadjointView<Upper>() = a.template selfadjointView<UpLo>().twistedBy(m_P);
671 }
672 else
673 {
674 m_Pinv.resize(0);
675 m_P.resize(0);
676 if(int(UpLo)==int(Lower) || MatrixType::IsRowMajor)
677 {
678 // we have to transpose the lower part to to the upper one
679 ap.resize(size,size);
680 ap.template selfadjointView<Upper>() = a.template selfadjointView<UpLo>();
681 }
682 else
683 internal::simplicial_cholesky_grab_input<CholMatrixType,MatrixType>::run(a, pmat, ap);
684 }
685}
void resize(Index newSize)
Definition PermutationMatrix.h:136
InverseReturnType inverse() const
Definition PermutationMatrix.h:196
internal::traits< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::OrderingType OrderingType
Definition SimplicialCholesky.h:62

◆ permutationP()

const PermutationMatrix< Dynamic, Dynamic, StorageIndex > & Eigen::SimplicialCholeskyBase< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::permutationP ( ) const
inlineinherited
Returns
the permutation P
See also
permutationPinv()
116 { return m_P; }

◆ permutationPinv()

const PermutationMatrix< Dynamic, Dynamic, StorageIndex > & Eigen::SimplicialCholeskyBase< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::permutationPinv ( ) const
inlineinherited
Returns
the inverse P^-1 of the permutation P
See also
permutationP()
121 { return m_Pinv; }

◆ rawMatrix()

template<typename _MatrixType , int _UpLo, typename _Ordering >
const CholMatrixType Eigen::SimplicialCholesky< _MatrixType, _UpLo, _Ordering >::rawMatrix ( ) const
inline

◆ rows()

Index Eigen::SimplicialCholeskyBase< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::rows ( ) const
inlineinherited
100{ return m_matrix.rows(); }
Index rows() const
Definition SparseMatrix.h:136

◆ setMode()

template<typename _MatrixType , int _UpLo, typename _Ordering >
SimplicialCholesky & Eigen::SimplicialCholesky< _MatrixType, _UpLo, _Ordering >::setMode ( SimplicialCholeskyMode  mode)
inline
527 {
528 switch(mode)
529 {
531 m_LDLT = false;
532 break;
534 m_LDLT = true;
535 break;
536 default:
537 break;
538 }
539
540 return *this;
541 }
@ SimplicialCholeskyLDLT
Definition SimplicialCholesky.h:17
@ SimplicialCholeskyLLT
Definition SimplicialCholesky.h:16

References Eigen::SimplicialCholesky< _MatrixType, _UpLo, _Ordering >::m_LDLT, Eigen::SimplicialCholeskyLDLT, and Eigen::SimplicialCholeskyLLT.

◆ setShift()

SimplicialCholesky< _MatrixType, _UpLo, _Ordering > & Eigen::SimplicialCholeskyBase< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::setShift ( const RealScalar offset,
const RealScalar scale = 1 
)
inlineinherited

Sets the shift parameters that will be used to adjust the diagonal coefficients during the numerical factorization.

During the numerical factorization, the diagonal coefficients are transformed by the following linear model:
d_ii = offset + scale * d_ii

The default is the identity transformation with offset=0, and scale=1.

Returns
a reference to *this.
133 {
136 return derived();
137 }
int scale(const int val)
Definition WipeTowerDialog.cpp:14
SimplicialCholesky< _MatrixType, _UpLo, _Ordering > & derived()
Definition SimplicialCholesky.h:96
void offset(Slic3r::ExPolygon &sh, coord_t distance, const PolygonTag &)
Definition geometries.hpp:132

◆ 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 }

◆ vectorD()

template<typename _MatrixType , int _UpLo, typename _Ordering >
const VectorType Eigen::SimplicialCholesky< _MatrixType, _UpLo, _Ordering >::vectorD ( ) const
inline

Member Data Documentation

◆ m_analysisIsOk

bool Eigen::SimplicialCholeskyBase< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::m_analysisIsOk
protectedinherited

◆ m_diag

VectorType Eigen::SimplicialCholeskyBase< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::m_diag
protectedinherited

◆ m_factorizationIsOk

bool Eigen::SimplicialCholeskyBase< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::m_factorizationIsOk
protectedinherited

◆ m_info

ComputationInfo Eigen::SimplicialCholeskyBase< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::m_info
mutableprotectedinherited

◆ m_isInitialized

bool Eigen::SparseSolverBase< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::m_isInitialized
mutableprivateinherited

◆ m_LDLT

◆ m_matrix

CholMatrixType Eigen::SimplicialCholeskyBase< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::m_matrix
protectedinherited

◆ m_nonZerosPerCol

VectorI Eigen::SimplicialCholeskyBase< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::m_nonZerosPerCol
protectedinherited

◆ m_P

PermutationMatrix<Dynamic,Dynamic,StorageIndex> Eigen::SimplicialCholeskyBase< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::m_P
protectedinherited

◆ m_parent

VectorI Eigen::SimplicialCholeskyBase< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::m_parent
protectedinherited

◆ m_Pinv

PermutationMatrix<Dynamic,Dynamic,StorageIndex> Eigen::SimplicialCholeskyBase< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::m_Pinv
protectedinherited

◆ m_shiftOffset

RealScalar Eigen::SimplicialCholeskyBase< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::m_shiftOffset
protectedinherited

◆ m_shiftScale

RealScalar Eigen::SimplicialCholeskyBase< SimplicialCholesky< _MatrixType, _UpLo, _Ordering > >::m_shiftScale
protectedinherited

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