19 template<
typename _MatrixType,
int _UpLo>
struct traits<
LDLT<_MatrixType,
_UpLo> >
59template<
typename _MatrixType,
int _UpLo>
class LDLT
112 template<
typename InputType>
129 template<
typename InputType>
149 inline typename Traits::MatrixU
matrixU()
const
156 inline typename Traits::MatrixL
matrixL()
const
191 #ifdef EIGEN_PARSED_BY_DOXYGEN
207 template<
typename Rhs>
212 template<
typename Derived>
215 template<
typename InputType>
227 template <
typename Derived>
263 #ifndef EIGEN_PARSED_BY_DOXYGEN
264 template<
typename RhsType,
typename DstType>
265 void _solve_impl(
const RhsType &rhs, DstType &dst)
const;
267 template<
bool Conjugate,
typename RhsType,
typename DstType>
299 template<
typename MatrixType,
typename TranspositionType,
typename Workspace>
303 typedef typename MatrixType::Scalar
Scalar;
304 typedef typename MatrixType::RealScalar
RealScalar;
305 typedef typename TranspositionType::StorageIndex IndexType;
358 temp.head(k) =
mat.diagonal().real().head(k).asDiagonal() * A10.adjoint();
359 mat.coeffRef(k,k) -= (A10 * temp.head(k)).value();
361 A21.noalias() -= A20 * temp.head(k);
371 if(k==0 && !pivot_is_valid)
378 transpositions.coeffRef(
j) = IndexType(
j);
384 if((rs>0) && pivot_is_valid)
389 if(found_zero_pivot && pivot_is_valid)
ret =
false;
390 else if(!pivot_is_valid) found_zero_pivot =
true;
412 template<
typename MatrixType,
typename WDerived>
416 typedef typename MatrixType::Scalar
Scalar;
417 typedef typename MatrixType::RealScalar
RealScalar;
450 template<
typename MatrixType,
typename TranspositionType,
typename Workspace,
typename WType>
462 template<
typename MatrixType,
typename TranspositionType,
typename Workspace>
469 template<
typename MatrixType,
typename TranspositionType,
typename Workspace,
typename WType>
497template<
typename MatrixType,
int _UpLo>
498template<
typename InputType>
501 check_template_parameters();
506 m_matrix =
a.derived();
514 abs_col_sum = m_matrix.col(
col).tail(
size -
col).template lpNorm<1>() + m_matrix.row(
col).head(
col).template lpNorm<1>();
516 abs_col_sum = m_matrix.col(
col).head(
col).template lpNorm<1>() + m_matrix.row(
col).tail(
size -
col).template lpNorm<1>();
517 if (abs_col_sum > m_l1_norm)
518 m_l1_norm = abs_col_sum;
521 m_transpositions.resize(
size);
522 m_isInitialized =
false;
523 m_temporary.resize(
size);
528 m_isInitialized =
true;
537template<
typename MatrixType,
int _UpLo>
538template<
typename Derived>
551 m_transpositions.resize(
size);
553 m_transpositions.coeffRef(
i) = IndexType(
i);
554 m_temporary.resize(
size);
556 m_isInitialized =
true;
564#ifndef EIGEN_PARSED_BY_DOXYGEN
565template<
typename _MatrixType,
int _UpLo>
566template<
typename RhsType,
typename DstType>
569 _solve_impl_transposed<true>(rhs, dst);
572template<
typename _MatrixType,
int _UpLo>
573template<
bool Conjugate,
typename RhsType,
typename DstType>
577 dst = m_transpositions * rhs;
581 matrixL().template conjugateIf<!Conjugate>().solveInPlace(dst);
595 RealScalar tolerance = (std::numeric_limits<RealScalar>::min)();
596 for (
Index i = 0;
i < vecD.size(); ++
i)
598 if(
abs(vecD(
i)) > tolerance)
599 dst.row(
i) /= vecD(
i);
601 dst.row(
i).setZero();
606 matrixL().transpose().template conjugateIf<Conjugate>().solveInPlace(dst);
610 dst = m_transpositions.transpose() * dst;
627template<
typename MatrixType,
int _UpLo>
628template<
typename Derived>
631 eigen_assert(m_isInitialized &&
"LDLT is not initialized.");
634 bAndX = this->solve(bAndX);
642template<
typename MatrixType,
int _UpLo>
645 eigen_assert(m_isInitialized &&
"LDLT is not initialized.");
651 res = transpositionsP() *
res;
655 res = vectorD().real().asDiagonal() *
res;
659 res = transpositionsP().transpose() *
res;
668template<
typename MatrixType,
unsigned int UpLo>
679template<
typename Derived>
Matrix3f m
Definition AngleAxis_mimic_euler.cpp:1
EIGEN_DEVICE_FUNC const SignReturnType sign() const
Definition ArrayCwiseUnaryOps.h:219
ArrayXXi a
Definition Array_initializer_list_23_cxx11.cpp:1
int i
Definition BiCGSTAB_step_by_step.cpp:9
#define EIGEN_GENERIC_PUBLIC_INTERFACE(Derived)
Definition Macros.h:1264
#define EIGEN_NOEXCEPT
Definition Macros.h:1418
#define EIGEN_CONSTEXPR
Definition Macros.h:787
#define EIGEN_DEVICE_FUNC
Definition Macros.h:976
#define eigen_assert(x)
Definition Macros.h:1037
#define EIGEN_STRONG_INLINE
Definition Macros.h:917
RowVector3d w
Definition Matrix_resize_int.cpp:3
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
Definition PartialRedux_count.cpp:3
#define EIGEN_STATIC_ASSERT_NON_INTEGER(TYPE)
Definition StaticAssert.h:187
MatrixXf mat
Definition Tutorial_AdvancedInitialization_CommaTemporary.cpp:1
Scalar * b
Definition benchVecAdd.cpp:17
Scalar Scalar int size
Definition benchVecAdd.cpp:17
SCALAR Scalar
Definition bench_gemm.cpp:46
NumTraits< Scalar >::Real RealScalar
Definition bench_gemm.cpp:47
MatrixXf MatrixType
Definition benchmark-blocking-sizes.cpp:52
Expression of a diagonal/subdiagonal/superdiagonal in a matrix.
Definition Diagonal.h:65
Robust Cholesky decomposition of a matrix with pivoting.
Definition LDLT.h:61
TranspositionType m_transpositions
Definition LDLT.h:286
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition LDLT.h:250
MatrixType m_matrix
Definition LDLT.h:284
LDLT(Index size)
Default Constructor with memory preallocation.
Definition LDLT.h:98
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Definition LDLT.h:249
LDLT()
Default Constructor.
Definition LDLT.h:85
internal::SignMatrix m_sign
Definition LDLT.h:288
ComputationInfo m_info
Definition LDLT.h:290
_MatrixType MatrixType
Definition LDLT.h:63
internal::LDLT_Traits< MatrixType, UpLo > Traits
Definition LDLT.h:78
LDLT & compute(const EigenBase< InputType > &matrix)
Traits::MatrixU matrixU() const
Definition LDLT.h:149
bool solveInPlace(MatrixBase< Derived > &bAndX) const
Definition LDLT.h:629
bool isPositive() const
Definition LDLT.h:178
PermutationMatrix< RowsAtCompileTime, MaxRowsAtCompileTime > PermutationType
Definition LDLT.h:76
ComputationInfo info() const
Reports whether previous computation was successful.
Definition LDLT.h:257
static void check_template_parameters()
Definition LDLT.h:273
void setZero()
Definition LDLT.h:143
RealScalar m_l1_norm
Definition LDLT.h:285
const MatrixType & matrixLDLT() const
Definition LDLT.h:234
void _solve_impl_transposed(const RhsType &rhs, DstType &dst) const
Definition LDLT.h:574
void _solve_impl(const RhsType &rhs, DstType &dst) const
Definition LDLT.h:567
SolverBase< LDLT > Base
Definition LDLT.h:64
bool isNegative(void) const
Definition LDLT.h:185
Diagonal< const MatrixType > vectorD() const
Definition LDLT.h:171
Matrix< Scalar, RowsAtCompileTime, 1, 0, MaxRowsAtCompileTime, 1 > TmpMatrixType
Definition LDLT.h:73
Transpositions< RowsAtCompileTime, MaxRowsAtCompileTime > TranspositionType
Definition LDLT.h:75
LDLT(const EigenBase< InputType > &matrix)
Constructor with decomposition.
Definition LDLT.h:113
@ MaxColsAtCompileTime
Definition LDLT.h:70
@ MaxRowsAtCompileTime
Definition LDLT.h:69
@ UpLo
Definition LDLT.h:71
TmpMatrixType m_temporary
Definition LDLT.h:287
LDLT(EigenBase< InputType > &matrix)
Constructs a LDLT factorization from a given matrix.
Definition LDLT.h:130
const LDLT & adjoint() const
Definition LDLT.h:247
MatrixType reconstructedMatrix() const
Definition LDLT.h:643
RealScalar rcond() const
Definition LDLT.h:221
bool m_isInitialized
Definition LDLT.h:289
Traits::MatrixL matrixL() const
Definition LDLT.h:156
const TranspositionType & transpositionsP() const
Definition LDLT.h:164
LDLT & rankUpdate(const MatrixBase< Derived > &w, const RealScalar &alpha=1)
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:50
const LDLT< PlainObject > ldlt() const
Definition LDLT.h:681
The matrix class, also used for vectors and row-vectors.
Definition Matrix.h:180
Permutation matrix.
Definition PermutationMatrix.h:298
const LDLT< PlainObject, UpLo > ldlt() const
Definition LDLT.h:670
Pseudo expression representing a solving operation.
Definition Solve.h:63
A base class for matrix decomposition and solvers.
Definition SolverBase.h:69
internal::traits< LDLT< _MatrixType, _UpLo > >::Scalar Scalar
Definition SolverBase.h:73
const Solve< LDLT< _MatrixType, _UpLo >, Rhs > solve(const MatrixBase< Rhs > &b) const
Definition SolverBase.h:106
EIGEN_DEVICE_FUNC LDLT< _MatrixType, _UpLo > & derived()
Definition EigenBase.h:46
Represents a sequence of transpositions (row/column interchange)
Definition Transpositions.h:156
IndicesType::Scalar StorageIndex
Definition Transpositions.h:162
Map< Matrix< T, Dynamic, Dynamic, ColMajor >, 0, OuterStride<> > matrix(T *data, int rows, int cols, int stride)
Definition common.h:110
#define isfinite(X)
Definition main.h:95
#define abs(x)
Definition datatypes.h:17
ComputationInfo
Definition Constants.h:440
@ Lower
Definition Constants.h:209
@ Upper
Definition Constants.h:211
@ NumericalIssue
Definition Constants.h:444
@ Success
Definition Constants.h:442
RealScalar s
Definition level1_cplx_impl.h:126
RealScalar alpha
Definition level1_cplx_impl.h:147
DenseIndex ret
Definition level1_cplx_impl.h:44
SignMatrix
Definition LDLT.h:31
@ PositiveSemiDef
Definition LDLT.h:31
@ ZeroSign
Definition LDLT.h:31
@ NegativeSemiDef
Definition LDLT.h:31
@ Indefinite
Definition LDLT.h:31
Decomposition::RealScalar rcond_estimate_helper(typename Decomposition::RealScalar matrix_norm, const Decomposition &dec)
Reciprocal condition number estimator.
Definition ConditionEstimator.h:159
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool() isfinite(const Eigen::bfloat16 &h)
Definition BFloat16.h:671
EIGEN_DEVICE_FUNC bool abs2(bool x)
Definition MathFunctions.h:1292
Namespace containing all symbols from the Eigen library.
Definition bench_norm.cpp:85
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:74
Definition BandTriangularSolver.h:13
Definition EigenBase.h:30
Eigen::Index Index
The interface type of indices.
Definition EigenBase.h:39
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index size() const EIGEN_NOEXCEPT
Definition EigenBase.h:67
Definition Constants.h:522
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition NumTraits.h:233
Definition Constants.h:513
static MatrixL getL(const MatrixType &m)
Definition LDLT.h:481
const TriangularView< const typename MatrixType::AdjointReturnType, UnitUpper > MatrixU
Definition LDLT.h:480
static MatrixU getU(const MatrixType &m)
Definition LDLT.h:482
const TriangularView< const MatrixType, UnitLower > MatrixL
Definition LDLT.h:479
const TriangularView< const typename MatrixType::AdjointReturnType, UnitLower > MatrixL
Definition LDLT.h:487
static MatrixL getL(const MatrixType &m)
Definition LDLT.h:489
const TriangularView< const MatrixType, UnitUpper > MatrixU
Definition LDLT.h:488
static MatrixU getU(const MatrixType &m)
Definition LDLT.h:490
static bool updateInPlace(MatrixType &mat, MatrixBase< WDerived > &w, const typename MatrixType::RealScalar &sigma=1)
Definition LDLT.h:413
static bool unblocked(MatrixType &mat, TranspositionType &transpositions, Workspace &temp, SignMatrix &sign)
Definition LDLT.h:300
static bool update(MatrixType &mat, const TranspositionType &transpositions, Workspace &tmp, const WType &w, const typename MatrixType::RealScalar &sigma=1)
Definition LDLT.h:451
static EIGEN_STRONG_INLINE bool update(MatrixType &mat, TranspositionType &transpositions, Workspace &tmp, WType &w, const typename MatrixType::RealScalar &sigma=1)
Definition LDLT.h:470
static EIGEN_STRONG_INLINE bool unblocked(MatrixType &mat, TranspositionType &transpositions, Workspace &temp, SignMatrix &sign)
Definition LDLT.h:463
SolverStorage StorageKind
Definition LDLT.h:23
MatrixXpr XprKind
Definition LDLT.h:22
int StorageIndex
Definition LDLT.h:24
Definition ForwardDeclarations.h:17
std::ptrdiff_t j
Definition tut_arithmetic_redux_minmax.cpp:2