Eigen::LDLT< MatrixType_, UpLo_ > Class Template Reference

Robust Cholesky decomposition of a matrix with pivoting. More...

#include <LDLT.h>

+ Inheritance diagram for Eigen::LDLT< MatrixType_, UpLo_ >:

Public Types

enum  { MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime , MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime , UpLo = UpLo_ }
 
typedef MatrixType_ MatrixType
 
typedef SolverBase< LDLTBase
 
typedef Matrix< Scalar, RowsAtCompileTime, 1, 0, MaxRowsAtCompileTime, 1 > TmpMatrixType
 
typedef Transpositions< RowsAtCompileTime, MaxRowsAtCompileTimeTranspositionType
 
typedef PermutationMatrix< RowsAtCompileTime, MaxRowsAtCompileTimePermutationType
 
typedef internal::LDLT_Traits< MatrixType, UpLoTraits
 
- Public Types inherited from Eigen::SolverBase< LDLT< MatrixType_, UpLo_ > >
enum  
 
typedef EigenBase< LDLT< MatrixType_, UpLo_ > > Base
 
typedef internal::traits< LDLT< MatrixType_, UpLo_ > >::Scalar Scalar
 
typedef Scalar CoeffReturnType
 
typedef Transpose< const LDLT< MatrixType_, UpLo_ > > ConstTransposeReturnType
 
typedef std::conditional_t< NumTraits< Scalar >::IsComplex, CwiseUnaryOp< internal::scalar_conjugate_op< Scalar >, const ConstTransposeReturnType >, const ConstTransposeReturnTypeAdjointReturnType
 
- Public Types inherited from Eigen::EigenBase< Derived >
typedef Eigen::Index Index
 The interface type of indices. More...
 
typedef internal::traits< Derived >::StorageKind StorageKind
 

Public Member Functions

 LDLT ()
 Default Constructor. More...
 
 LDLT (Index size)
 Default Constructor with memory preallocation. More...
 
template<typename InputType >
 LDLT (const EigenBase< InputType > &matrix)
 Constructor with decomposition. More...
 
template<typename InputType >
 LDLT (EigenBase< InputType > &matrix)
 Constructs a LDLT factorization from a given matrix. More...
 
void setZero ()
 
Traits::MatrixU matrixU () const
 
Traits::MatrixL matrixL () const
 
const TranspositionTypetranspositionsP () const
 
Diagonal< const MatrixTypevectorD () const
 
bool isPositive () const
 
bool isNegative (void) const
 
template<typename Derived >
bool solveInPlace (MatrixBase< Derived > &bAndX) const
 
template<typename InputType >
LDLTcompute (const EigenBase< InputType > &matrix)
 
RealScalar rcond () const
 
template<typename Derived >
LDLTrankUpdate (const MatrixBase< Derived > &w, const RealScalar &alpha=1)
 
const MatrixTypematrixLDLT () const
 
MatrixType reconstructedMatrix () const
 
const LDLTadjoint () const
 
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows () const EIGEN_NOEXCEPT
 
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols () const EIGEN_NOEXCEPT
 
ComputationInfo info () const
 Reports whether previous computation was successful. More...
 
template<typename RhsType , typename DstType >
void _solve_impl (const RhsType &rhs, DstType &dst) const
 
template<bool Conjugate, typename RhsType , typename DstType >
void _solve_impl_transposed (const RhsType &rhs, DstType &dst) const
 
template<typename InputType >
LDLT< MatrixType, UpLo_ > & compute (const EigenBase< InputType > &a)
 
template<typename Derived >
LDLT< MatrixType, UpLo_ > & rankUpdate (const MatrixBase< Derived > &w, const typename LDLT< MatrixType, UpLo_ >::RealScalar &sigma)
 
- Public Member Functions inherited from Eigen::SolverBase< LDLT< MatrixType_, UpLo_ > >
 SolverBase ()
 
 ~SolverBase ()
 
const Solve< LDLT< MatrixType_, UpLo_ >, Rhs > solve (const MatrixBase< Rhs > &b) const
 
const ConstTransposeReturnType transpose () const
 
const AdjointReturnType adjoint () const
 
constexpr EIGEN_DEVICE_FUNC LDLT< MatrixType_, UpLo_ > & derived ()
 
constexpr EIGEN_DEVICE_FUNC const LDLT< MatrixType_, UpLo_ > & derived () const
 
- Public Member Functions inherited from Eigen::EigenBase< Derived >
constexpr EIGEN_DEVICE_FUNC Derived & derived ()
 
constexpr EIGEN_DEVICE_FUNC const Derived & derived () const
 
EIGEN_DEVICE_FUNC Derived & const_cast_derived () const
 
EIGEN_DEVICE_FUNC const Derived & const_derived () const
 
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows () const EIGEN_NOEXCEPT
 
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols () const EIGEN_NOEXCEPT
 
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index size () const EIGEN_NOEXCEPT
 
template<typename Dest >
EIGEN_DEVICE_FUNC void evalTo (Dest &dst) const
 
template<typename Dest >
EIGEN_DEVICE_FUNC void addTo (Dest &dst) const
 
template<typename Dest >
EIGEN_DEVICE_FUNC void subTo (Dest &dst) const
 
template<typename Dest >
EIGEN_DEVICE_FUNC void applyThisOnTheRight (Dest &dst) const
 
template<typename Dest >
EIGEN_DEVICE_FUNC void applyThisOnTheLeft (Dest &dst) const
 
template<typename Device >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DeviceWrapper< Derived, Device > device (Device &device)
 
template<typename Device >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DeviceWrapper< const Derived, Device > device (Device &device) const
 

Protected Attributes

MatrixType m_matrix
 
RealScalar m_l1_norm
 
TranspositionType m_transpositions
 
TmpMatrixType m_temporary
 
internal::SignMatrix m_sign
 
bool m_isInitialized
 
ComputationInfo m_info
 

Friends

class SolverBase< LDLT >
 

Additional Inherited Members

- Protected Member Functions inherited from Eigen::SolverBase< LDLT< MatrixType_, UpLo_ > >
void _check_solve_assertion (const Rhs &b) const
 

Detailed Description

template<typename MatrixType_, int UpLo_>
class Eigen::LDLT< MatrixType_, UpLo_ >

Robust Cholesky decomposition of a matrix with pivoting.

Template Parameters
MatrixType_the type of the matrix of which to compute the LDL^T Cholesky decomposition
UpLo_the triangular part that will be used for the decomposition: Lower (default) or Upper. The other triangular part won't be read.

Perform a robust Cholesky decomposition of a positive semidefinite or negative semidefinite matrix \( A \) such that \( A = P^TLDL^*P \), where P is a permutation matrix, L is lower triangular with a unit diagonal and D is a diagonal matrix.

The decomposition uses pivoting to ensure stability, so that D will have zeros in the bottom right rank(A) - n submatrix. Avoiding the square root on D also stabilizes the computation.

Remember that Cholesky decompositions are not rank-revealing. Also, do not use a Cholesky decomposition to determine whether a system of equations has a solution.

This class supports the inplace decomposition mechanism.

See also
MatrixBase::ldlt(), SelfAdjointView::ldlt(), class LLT

Member Typedef Documentation

◆ Base

template<typename MatrixType_ , int UpLo_>
typedef SolverBase<LDLT> Eigen::LDLT< MatrixType_, UpLo_ >::Base

◆ MatrixType

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

◆ PermutationType

template<typename MatrixType_ , int UpLo_>
typedef PermutationMatrix<RowsAtCompileTime, MaxRowsAtCompileTime> Eigen::LDLT< MatrixType_, UpLo_ >::PermutationType

◆ TmpMatrixType

template<typename MatrixType_ , int UpLo_>
typedef Matrix<Scalar, RowsAtCompileTime, 1, 0, MaxRowsAtCompileTime, 1> Eigen::LDLT< MatrixType_, UpLo_ >::TmpMatrixType

◆ Traits

template<typename MatrixType_ , int UpLo_>
typedef internal::LDLT_Traits<MatrixType, UpLo> Eigen::LDLT< MatrixType_, UpLo_ >::Traits

◆ TranspositionType

template<typename MatrixType_ , int UpLo_>
typedef Transpositions<RowsAtCompileTime, MaxRowsAtCompileTime> Eigen::LDLT< MatrixType_, UpLo_ >::TranspositionType

Member Enumeration Documentation

◆ anonymous enum

template<typename MatrixType_ , int UpLo_>
anonymous enum
Enumerator
MaxRowsAtCompileTime 
MaxColsAtCompileTime 
UpLo 
70  {
71  MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
72  MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime,
73  UpLo = UpLo_
74  };
@ MaxColsAtCompileTime
Definition: LDLT.h:72
@ MaxRowsAtCompileTime
Definition: LDLT.h:71
@ UpLo
Definition: LDLT.h:73

Constructor & Destructor Documentation

◆ LDLT() [1/4]

template<typename MatrixType_ , int UpLo_>
Eigen::LDLT< MatrixType_, UpLo_ >::LDLT ( )
inline

Default Constructor.

The default constructor is useful in cases in which the user intends to perform decompositions via LDLT::compute(const MatrixType&).

internal::SignMatrix m_sign
Definition: LDLT.h:267
bool m_isInitialized
Definition: LDLT.h:268
TranspositionType m_transpositions
Definition: LDLT.h:265
MatrixType m_matrix
Definition: LDLT.h:263
@ ZeroSign
Definition: LDLT.h:34

◆ LDLT() [2/4]

template<typename MatrixType_ , int UpLo_>
Eigen::LDLT< MatrixType_, UpLo_ >::LDLT ( Index  size)
inlineexplicit

Default Constructor with memory preallocation.

Like the default constructor but with preallocation of the internal data according to the specified problem size.

See also
LDLT()
96  : m_matrix(size, size),
100  m_isInitialized(false) {}
TmpMatrixType m_temporary
Definition: LDLT.h:266
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index size() const EIGEN_NOEXCEPT
Definition: EigenBase.h:64

◆ LDLT() [3/4]

template<typename MatrixType_ , int UpLo_>
template<typename InputType >
Eigen::LDLT< MatrixType_, UpLo_ >::LDLT ( const EigenBase< InputType > &  matrix)
inlineexplicit

Constructor with decomposition.

This calculates the decomposition for the input matrix.

See also
LDLT(Index size)
110  : m_matrix(matrix.rows(), matrix.cols()),
111  m_transpositions(matrix.rows()),
112  m_temporary(matrix.rows()),
114  m_isInitialized(false) {
115  compute(matrix.derived());
116  }
LDLT & compute(const EigenBase< InputType > &matrix)
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::LDLT< MatrixType_, UpLo_ >::compute(), and matrix().

◆ LDLT() [4/4]

template<typename MatrixType_ , int UpLo_>
template<typename InputType >
Eigen::LDLT< MatrixType_, UpLo_ >::LDLT ( EigenBase< InputType > &  matrix)
inlineexplicit

Constructs a LDLT factorization from a given matrix.

This overloaded constructor is provided for inplace decomposition when MatrixType is a Eigen::Ref.

See also
LDLT(const EigenBase&)
127  : m_matrix(matrix.derived()),
128  m_transpositions(matrix.rows()),
129  m_temporary(matrix.rows()),
131  m_isInitialized(false) {
132  compute(matrix.derived());
133  }

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

Member Function Documentation

◆ _solve_impl()

template<typename MatrixType_ , int UpLo_>
template<typename RhsType , typename DstType >
void Eigen::LDLT< MatrixType_, UpLo_ >::_solve_impl ( const RhsType &  rhs,
DstType &  dst 
) const
537  {
538  _solve_impl_transposed<true>(rhs, dst);
539 }

◆ _solve_impl_transposed()

template<typename MatrixType_ , int UpLo_>
template<bool Conjugate, typename RhsType , typename DstType >
void Eigen::LDLT< MatrixType_, UpLo_ >::_solve_impl_transposed ( const RhsType &  rhs,
DstType &  dst 
) const
543  {
544  // dst = P b
545  dst = m_transpositions * rhs;
546 
547  // dst = L^-1 (P b)
548  // dst = L^-*T (P b)
549  matrixL().template conjugateIf<!Conjugate>().solveInPlace(dst);
550 
551  // dst = D^-* (L^-1 P b)
552  // dst = D^-1 (L^-*T P b)
553  // more precisely, use pseudo-inverse of D (see bug 241)
554  using std::abs;
555  const typename Diagonal<const MatrixType>::RealReturnType vecD(vectorD());
556  // In some previous versions, tolerance was set to the max of 1/highest (or rather numeric_limits::min())
557  // and the maximal diagonal entry * epsilon as motivated by LAPACK's xGELSS:
558  // RealScalar tolerance = numext::maxi(vecD.array().abs().maxCoeff() * NumTraits<RealScalar>::epsilon(),RealScalar(1)
559  // / NumTraits<RealScalar>::highest()); However, LDLT is not rank revealing, and so adjusting the tolerance wrt to the
560  // highest diagonal element is not well justified and leads to numerical issues in some cases. Moreover, Lapack's
561  // xSYTRS routines use 0 for the tolerance. Using numeric_limits::min() gives us more robustness to denormals.
563  for (Index i = 0; i < vecD.size(); ++i) {
564  if (abs(vecD(i)) > tolerance)
565  dst.row(i) /= vecD(i);
566  else
567  dst.row(i).setZero();
568  }
569 
570  // dst = L^-* (D^-* L^-1 P b)
571  // dst = L^-T (D^-1 L^-*T P b)
572  matrixL().transpose().template conjugateIf<Conjugate>().solveInPlace(dst);
573 
574  // dst = P^T (L^-* D^-* L^-1 P b) = A^-1 b
575  // dst = P^-T (L^-T D^-1 L^-*T P b) = A^-1 b
576  dst = m_transpositions.transpose() * dst;
577 }
AnnoyingScalar abs(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:135
int i
Definition: BiCGSTAB_step_by_step.cpp:9
NumTraits< Scalar >::Real RealScalar
Definition: bench_gemm.cpp:46
Traits::MatrixL matrixL() const
Definition: LDLT.h:147
Diagonal< const MatrixType > vectorD() const
Definition: LDLT.h:160
Transpose< TranspositionsBase > transpose() const
Definition: Transpositions.h:95
#define min(a, b)
Definition: datatypes.h:22
Eigen::Index Index
The interface type of indices.
Definition: EigenBase.h:43

References abs(), i, Eigen::LDLT< MatrixType_, UpLo_ >::m_transpositions, Eigen::LDLT< MatrixType_, UpLo_ >::matrixL(), min, Eigen::TranspositionsBase< Derived >::transpose(), and Eigen::LDLT< MatrixType_, UpLo_ >::vectorD().

◆ adjoint()

template<typename MatrixType_ , int UpLo_>
const LDLT& Eigen::LDLT< MatrixType_, UpLo_ >::adjoint ( ) const
inline
Returns
the adjoint of *this, that is, a const reference to the decomposition itself as the underlying matrix is self-adjoint.

This method is provided for compatibility with other matrix decompositions, thus enabling generic code such as:

x = decomposition.adjoint().solve(b)
Scalar * b
Definition: benchVecAdd.cpp:17
list x
Definition: plotDoE.py:28
231 { return *this; }

Referenced by cholesky_verify_assert().

◆ cols()

◆ compute() [1/2]

template<typename MatrixType_ , int UpLo_>
template<typename InputType >
LDLT<MatrixType, UpLo_>& Eigen::LDLT< MatrixType_, UpLo_ >::compute ( const EigenBase< InputType > &  a)

Compute / recompute the LDLT decomposition A = L D L^* = U^* D U of matrix

474  {
475  eigen_assert(a.rows() == a.cols());
476  const Index size = a.rows();
477 
478  m_matrix = a.derived();
479 
480  // Compute matrix L1 norm = max abs column sum.
481  m_l1_norm = RealScalar(0);
482  // TODO move this code to SelfAdjointView
483  for (Index col = 0; col < size; ++col) {
484  RealScalar abs_col_sum;
485  if (UpLo_ == Lower)
486  abs_col_sum =
487  m_matrix.col(col).tail(size - col).template lpNorm<1>() + m_matrix.row(col).head(col).template lpNorm<1>();
488  else
489  abs_col_sum =
490  m_matrix.col(col).head(col).template lpNorm<1>() + m_matrix.row(col).tail(size - col).template lpNorm<1>();
491  if (abs_col_sum > m_l1_norm) m_l1_norm = abs_col_sum;
492  }
493 
495  m_isInitialized = false;
498 
499  m_info = internal::ldlt_inplace<UpLo>::unblocked(m_matrix, m_transpositions, m_temporary, m_sign) ? Success
500  : NumericalIssue;
501 
502  m_isInitialized = true;
503  return *this;
504 }
#define eigen_assert(x)
Definition: Macros.h:910
m col(1)
ComputationInfo m_info
Definition: LDLT.h:269
RealScalar m_l1_norm
Definition: LDLT.h:264
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE void resize(Index rows, Index cols)
Definition: PlainObjectBase.h:294
void resize(Index newSize)
Definition: Transpositions.h:63
@ Lower
Definition: Constants.h:211
@ NumericalIssue
Definition: Constants.h:442
@ Success
Definition: Constants.h:440
const Scalar * a
Definition: level2_cplx_impl.h:32

References a, col(), eigen_assert, Eigen::Lower, Eigen::LDLT< MatrixType_, UpLo_ >::m_info, Eigen::LDLT< MatrixType_, UpLo_ >::m_isInitialized, Eigen::LDLT< MatrixType_, UpLo_ >::m_l1_norm, Eigen::LDLT< MatrixType_, UpLo_ >::m_matrix, Eigen::LDLT< MatrixType_, UpLo_ >::m_sign, Eigen::LDLT< MatrixType_, UpLo_ >::m_temporary, Eigen::LDLT< MatrixType_, UpLo_ >::m_transpositions, Eigen::NumericalIssue, Eigen::TranspositionsBase< Derived >::resize(), Eigen::PlainObjectBase< Derived >::resize(), Eigen::EigenBase< Derived >::size(), Eigen::Success, and Eigen::internal::ZeroSign.

◆ compute() [2/2]

template<typename MatrixType_ , int UpLo_>
template<typename InputType >
LDLT& Eigen::LDLT< MatrixType_, UpLo_ >::compute ( const EigenBase< InputType > &  matrix)

◆ info()

template<typename MatrixType_ , int UpLo_>
ComputationInfo Eigen::LDLT< MatrixType_, UpLo_ >::info ( ) const
inline

Reports whether previous computation was successful.

Returns
Success if computation was successful, NumericalIssue if the factorization failed because of a zero pivot.
241  {
242  eigen_assert(m_isInitialized && "LDLT is not initialized.");
243  return m_info;
244  }

References eigen_assert, Eigen::LDLT< MatrixType_, UpLo_ >::m_info, and Eigen::LDLT< MatrixType_, UpLo_ >::m_isInitialized.

Referenced by cholesky(), cholesky_cplx(), cholesky_definiteness(), and cholesky_faillure_cases().

◆ isNegative()

template<typename MatrixType_ , int UpLo_>
bool Eigen::LDLT< MatrixType_, UpLo_ >::isNegative ( void  ) const
inline
Returns
true if the matrix is negative (semidefinite)
172  {
173  eigen_assert(m_isInitialized && "LDLT is not initialized.");
175  }
@ NegativeSemiDef
Definition: LDLT.h:34

References eigen_assert, Eigen::LDLT< MatrixType_, UpLo_ >::m_isInitialized, Eigen::LDLT< MatrixType_, UpLo_ >::m_sign, Eigen::internal::NegativeSemiDef, and Eigen::internal::ZeroSign.

Referenced by cholesky_definiteness(), and cholesky_verify_assert().

◆ isPositive()

template<typename MatrixType_ , int UpLo_>
bool Eigen::LDLT< MatrixType_, UpLo_ >::isPositive ( ) const
inline
Returns
true if the matrix is positive (semidefinite)
166  {
167  eigen_assert(m_isInitialized && "LDLT is not initialized.");
169  }
@ PositiveSemiDef
Definition: LDLT.h:34

References eigen_assert, Eigen::LDLT< MatrixType_, UpLo_ >::m_isInitialized, Eigen::LDLT< MatrixType_, UpLo_ >::m_sign, Eigen::internal::PositiveSemiDef, and Eigen::internal::ZeroSign.

Referenced by cholesky_definiteness(), and cholesky_verify_assert().

◆ matrixL()

template<typename MatrixType_ , int UpLo_>
Traits::MatrixL Eigen::LDLT< MatrixType_, UpLo_ >::matrixL ( ) const
inline

◆ matrixLDLT()

template<typename MatrixType_ , int UpLo_>
const MatrixType& Eigen::LDLT< MatrixType_, UpLo_ >::matrixLDLT ( ) const
inline
Returns
the internal LDLT decomposition matrix

TODO: document the storage layout

218  {
219  eigen_assert(m_isInitialized && "LDLT is not initialized.");
220  return m_matrix;
221  }

References eigen_assert, Eigen::LDLT< MatrixType_, UpLo_ >::m_isInitialized, and Eigen::LDLT< MatrixType_, UpLo_ >::m_matrix.

◆ matrixU()

template<typename MatrixType_ , int UpLo_>
Traits::MatrixU Eigen::LDLT< MatrixType_, UpLo_ >::matrixU ( ) const
inline
Returns
a view of the upper triangular matrix U
141  {
142  eigen_assert(m_isInitialized && "LDLT is not initialized.");
143  return Traits::getU(m_matrix);
144  }

References eigen_assert, Eigen::LDLT< MatrixType_, UpLo_ >::m_isInitialized, and Eigen::LDLT< MatrixType_, UpLo_ >::m_matrix.

Referenced by cholesky(), and Eigen::LDLT< MatrixType_, UpLo_ >::reconstructedMatrix().

◆ rankUpdate() [1/2]

template<typename MatrixType_ , int UpLo_>
template<typename Derived >
LDLT& Eigen::LDLT< MatrixType_, UpLo_ >::rankUpdate ( const MatrixBase< Derived > &  w,
const RealScalar alpha = 1 
)

◆ rankUpdate() [2/2]

template<typename MatrixType_ , int UpLo_>
template<typename Derived >
LDLT<MatrixType, UpLo_>& Eigen::LDLT< MatrixType_, UpLo_ >::rankUpdate ( const MatrixBase< Derived > &  w,
const typename LDLT< MatrixType, UpLo_ >::RealScalar sigma 
)

Update the LDLT decomposition: given A = L D L^T, efficiently compute the decomposition of A + sigma w w^T.

Parameters
wa vector to be incorporated into the decomposition.
sigmaa scalar, +1 for updates and -1 for "downdates," which correspond to removing previously-added column vectors. Optional; default value is +1.
See also
setZero()
514  {
515  typedef typename TranspositionType::StorageIndex IndexType;
516  const Index size = w.rows();
517  if (m_isInitialized) {
518  eigen_assert(m_matrix.rows() == size);
519  } else {
520  m_matrix.resize(size, size);
521  m_matrix.setZero();
523  for (Index i = 0; i < size; i++) m_transpositions.coeffRef(i) = IndexType(i);
526  m_isInitialized = true;
527  }
528 
529  internal::ldlt_inplace<UpLo>::update(m_matrix, m_transpositions, m_temporary, w, sigma);
530 
531  return *this;
532 }
RowVector3d w
Definition: Matrix_resize_int.cpp:3
StorageIndex & coeffRef(Index i)
Definition: Transpositions.h:47
IndicesType::Scalar StorageIndex
Definition: Transpositions.h:147
int sigma
Definition: calibrate.py:179

References Eigen::TranspositionsBase< Derived >::coeffRef(), eigen_assert, i, Eigen::LDLT< MatrixType_, UpLo_ >::m_isInitialized, Eigen::LDLT< MatrixType_, UpLo_ >::m_matrix, Eigen::LDLT< MatrixType_, UpLo_ >::m_sign, Eigen::LDLT< MatrixType_, UpLo_ >::m_temporary, Eigen::LDLT< MatrixType_, UpLo_ >::m_transpositions, Eigen::internal::NegativeSemiDef, Eigen::internal::PositiveSemiDef, Eigen::TranspositionsBase< Derived >::resize(), Eigen::PlainObjectBase< Derived >::resize(), calibrate::sigma, Eigen::EigenBase< Derived >::size(), and w.

◆ rcond()

template<typename MatrixType_ , int UpLo_>
RealScalar Eigen::LDLT< MatrixType_, UpLo_ >::rcond ( ) const
inline
Returns
an estimate of the reciprocal condition number of the matrix of which *this is the LDLT decomposition.
206  {
207  eigen_assert(m_isInitialized && "LDLT is not initialized.");
209  }
Decomposition::RealScalar rcond_estimate_helper(typename Decomposition::RealScalar matrix_norm, const Decomposition &dec)
Reciprocal condition number estimator.
Definition: ConditionEstimator.h:157

References eigen_assert, Eigen::LDLT< MatrixType_, UpLo_ >::m_isInitialized, Eigen::LDLT< MatrixType_, UpLo_ >::m_l1_norm, and Eigen::internal::rcond_estimate_helper().

Referenced by cholesky().

◆ reconstructedMatrix()

template<typename MatrixType , int UpLo_>
MatrixType Eigen::LDLT< MatrixType, UpLo_ >::reconstructedMatrix
Returns
the matrix represented by the decomposition, i.e., it returns the product: P^T L D L^* P. This function is provided for debug purpose.
608  {
609  eigen_assert(m_isInitialized && "LDLT is not initialized.");
610  const Index size = m_matrix.rows();
612 
613  // P
614  res.setIdentity();
615  res = transpositionsP() * res;
616  // L^* P
617  res = matrixU() * res;
618  // D(L^*P)
619  res = vectorD().real().asDiagonal() * res;
620  // L(DL^*P)
621  res = matrixL() * res;
622  // P^T (LDL^*P)
624 
625  return res;
626 }
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
Definition: PartialRedux_count.cpp:3
MatrixXf MatrixType
Definition: benchmark-blocking-sizes.cpp:52
const TranspositionType & transpositionsP() const
Definition: LDLT.h:154
Traits::MatrixU matrixU() const
Definition: LDLT.h:141

References eigen_assert, Eigen::LDLT< MatrixType_, UpLo_ >::m_isInitialized, Eigen::LDLT< MatrixType_, UpLo_ >::m_matrix, Eigen::LDLT< MatrixType_, UpLo_ >::matrixL(), Eigen::LDLT< MatrixType_, UpLo_ >::matrixU(), res, Eigen::EigenBase< Derived >::size(), Eigen::TranspositionsBase< Derived >::transpose(), Eigen::LDLT< MatrixType_, UpLo_ >::transpositionsP(), and Eigen::LDLT< MatrixType_, UpLo_ >::vectorD().

Referenced by cholesky(), cholesky_cplx(), cholesky_definiteness(), and cholesky_faillure_cases().

◆ rows()

◆ setZero()

template<typename MatrixType_ , int UpLo_>
void Eigen::LDLT< MatrixType_, UpLo_ >::setZero ( )
inline

Clear any existing decomposition

See also
rankUpdate(w,sigma)
138 { m_isInitialized = false; }

References Eigen::LDLT< MatrixType_, UpLo_ >::m_isInitialized.

◆ solveInPlace()

template<typename MatrixType , int UpLo_>
template<typename Derived >
bool Eigen::LDLT< MatrixType, UpLo_ >::solveInPlace ( MatrixBase< Derived > &  bAndX) const

use x = ldlt_object.solve(x);

This is the in-place version of solve().

Parameters
bAndXrepresents both the right-hand side matrix b and result x.
Returns
true always! If you need to check for existence of solutions, use another decomposition like LU, QR, or SVD.

This version avoids a copy when the right hand side matrix b is not needed anymore.

See also
LDLT::solve(), MatrixBase::ldlt()
595  {
596  eigen_assert(m_isInitialized && "LDLT is not initialized.");
597  eigen_assert(m_matrix.rows() == bAndX.rows());
598 
599  bAndX = this->solve(bAndX);
600 
601  return true;
602 }
const Solve< LDLT< MatrixType_, UpLo_ >, Rhs > solve(const MatrixBase< Rhs > &b) const
Definition: SolverBase.h:106

References eigen_assert, Eigen::LDLT< MatrixType_, UpLo_ >::m_isInitialized, Eigen::LDLT< MatrixType_, UpLo_ >::m_matrix, and Eigen::SolverBase< LDLT< MatrixType_, UpLo_ > >::solve().

Referenced by cholesky_verify_assert().

◆ transpositionsP()

template<typename MatrixType_ , int UpLo_>
const TranspositionType& Eigen::LDLT< MatrixType_, UpLo_ >::transpositionsP ( ) const
inline
Returns
the permutation matrix P as a transposition sequence.
154  {
155  eigen_assert(m_isInitialized && "LDLT is not initialized.");
156  return m_transpositions;
157  }

References eigen_assert, Eigen::LDLT< MatrixType_, UpLo_ >::m_isInitialized, and Eigen::LDLT< MatrixType_, UpLo_ >::m_transpositions.

Referenced by cholesky_verify_assert(), and Eigen::LDLT< MatrixType_, UpLo_ >::reconstructedMatrix().

◆ vectorD()

template<typename MatrixType_ , int UpLo_>
Diagonal<const MatrixType> Eigen::LDLT< MatrixType_, UpLo_ >::vectorD ( ) const
inline

Friends And Related Function Documentation

◆ SolverBase< LDLT >

template<typename MatrixType_ , int UpLo_>
friend class SolverBase< LDLT >
friend

Member Data Documentation

◆ m_info

template<typename MatrixType_ , int UpLo_>
ComputationInfo Eigen::LDLT< MatrixType_, UpLo_ >::m_info
protected

◆ m_isInitialized

◆ m_l1_norm

template<typename MatrixType_ , int UpLo_>
RealScalar Eigen::LDLT< MatrixType_, UpLo_ >::m_l1_norm
protected

◆ m_matrix

template<typename MatrixType_ , int UpLo_>
MatrixType Eigen::LDLT< MatrixType_, UpLo_ >::m_matrix
protected

◆ m_sign

◆ m_temporary

template<typename MatrixType_ , int UpLo_>
TmpMatrixType Eigen::LDLT< MatrixType_, UpLo_ >::m_temporary
protected

◆ m_transpositions


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