21 template<
typename MatrixType_,
int UpLo_>
struct traits<LDLT<MatrixType_, UpLo_> >
24 typedef MatrixXpr XprKind;
25 typedef SolverStorage StorageKind;
26 typedef int StorageIndex;
30 template<
typename MatrixType,
int UpLo>
struct LDLT_Traits;
61 template<
typename MatrixType_,
int UpLo_>
class LDLT
80 typedef internal::LDLT_Traits<MatrixType,UpLo>
Traits;
114 template<
typename InputType>
131 template<
typename InputType>
151 inline typename Traits::MatrixU
matrixU()
const
158 inline typename Traits::MatrixL
matrixL()
const
193 #ifdef EIGEN_PARSED_BY_DOXYGEN
209 template<
typename Rhs>
214 template<
typename Derived>
217 template<
typename InputType>
229 template <
typename Derived>
265 #ifndef EIGEN_PARSED_BY_DOXYGEN
266 template<
typename RhsType,
typename DstType>
267 void _solve_impl(
const RhsType &rhs, DstType &dst)
const;
269 template<
bool Conjugate,
typename RhsType,
typename DstType>
270 void _solve_impl_transposed(
const RhsType &rhs, DstType &dst)
const;
294 template<
int UpLo>
struct ldlt_inplace;
296 template<>
struct ldlt_inplace<
Lower>
298 template<
typename MatrixType,
typename TranspositionType,
typename Workspace>
307 bool found_zero_pivot =
false;
323 Index index_of_biggest_in_corner;
324 mat.diagonal().tail(
size-k).cwiseAbs().maxCoeff(&index_of_biggest_in_corner);
325 index_of_biggest_in_corner += k;
327 transpositions.
coeffRef(k) = IndexType(index_of_biggest_in_corner);
328 if(k != index_of_biggest_in_corner)
332 Index s =
size-index_of_biggest_in_corner-1;
333 mat.row(k).head(k).swap(
mat.row(index_of_biggest_in_corner).head(k));
334 mat.col(k).tail(s).swap(
mat.col(index_of_biggest_in_corner).tail(s));
335 std::swap(
mat.coeffRef(k,k),
mat.coeffRef(index_of_biggest_in_corner,index_of_biggest_in_corner));
336 for(
Index i=k+1;
i<index_of_biggest_in_corner;++
i)
343 mat.coeffRef(index_of_biggest_in_corner,k) =
numext::conj(
mat.coeff(index_of_biggest_in_corner,k));
357 temp.head(k) =
mat.diagonal().real().head(k).asDiagonal() * A10.adjoint();
358 mat.coeffRef(k,k) -= (A10 * temp.head(k)).value();
360 A21.noalias() -= A20 * temp.head(k);
368 bool pivot_is_valid = (
abs(realAkk) > RealScalar(0));
370 if(k==0 && !pivot_is_valid)
383 if((rs>0) && pivot_is_valid)
386 ret = ret && (A21.array()==
Scalar(0)).
all();
388 if(found_zero_pivot && pivot_is_valid) ret =
false;
389 else if(!pivot_is_valid) found_zero_pivot =
true;
411 template<
typename MatrixType,
typename WDerived>
421 RealScalar alpha = 1;
434 RealScalar gamma = dj*alpha + swj2;
436 mat.coeffRef(
j,
j) += swj2/alpha;
442 w.tail(rs) -= wj *
mat.col(
j).tail(rs);
449 template<
typename MatrixType,
typename TranspositionType,
typename Workspace,
typename WType>
453 tmp = transpositions *
w;
455 return ldlt_inplace<Lower>::updateInPlace(
mat,tmp,sigma);
459 template<>
struct ldlt_inplace<
Upper>
461 template<
typename MatrixType,
typename TranspositionType,
typename Workspace>
464 Transpose<MatrixType> matt(
mat);
465 return ldlt_inplace<Lower>::unblocked(matt, transpositions, temp,
sign);
468 template<
typename MatrixType,
typename TranspositionType,
typename Workspace,
typename WType>
471 Transpose<MatrixType> matt(
mat);
472 return ldlt_inplace<Lower>::update(matt, transpositions, tmp,
w.conjugate(), sigma);
478 typedef const TriangularView<const MatrixType, UnitLower> MatrixL;
479 typedef const TriangularView<const typename MatrixType::AdjointReturnType, UnitUpper> MatrixU;
480 static inline MatrixL getL(
const MatrixType&
m) {
return MatrixL(
m); }
481 static inline MatrixU getU(
const MatrixType&
m) {
return MatrixU(
m.adjoint()); }
486 typedef const TriangularView<const typename MatrixType::AdjointReturnType, UnitLower> MatrixL;
487 typedef const TriangularView<const MatrixType, UnitUpper> MatrixU;
488 static inline MatrixL getL(
const MatrixType&
m) {
return MatrixL(
m.adjoint()); }
489 static inline MatrixU getU(
const MatrixType&
m) {
return MatrixU(
m); }
496 template<
typename MatrixType,
int UpLo_>
497 template<
typename InputType>
509 RealScalar abs_col_sum;
534 template<
typename MatrixType,
int UpLo_>
535 template<
typename Derived>
561 #ifndef EIGEN_PARSED_BY_DOXYGEN
562 template<
typename MatrixType_,
int UpLo_>
563 template<
typename RhsType,
typename DstType>
566 _solve_impl_transposed<true>(rhs, dst);
569 template<
typename MatrixType_,
int UpLo_>
570 template<
bool Conjugate,
typename RhsType,
typename DstType>
571 void LDLT<MatrixType_,UpLo_>::_solve_impl_transposed(
const RhsType &rhs, DstType &dst)
const
578 matrixL().template conjugateIf<!Conjugate>().solveInPlace(dst);
584 const typename Diagonal<const MatrixType>::RealReturnType vecD(
vectorD());
593 for (
Index i = 0;
i < vecD.size(); ++
i)
595 if(
abs(vecD(
i)) > tolerance)
596 dst.row(
i) /= vecD(
i);
598 dst.row(
i).setZero();
603 matrixL().transpose().template conjugateIf<Conjugate>().solveInPlace(dst);
624 template<
typename MatrixType,
int UpLo_>
625 template<
typename Derived>
631 bAndX = this->
solve(bAndX);
639 template<
typename MatrixType,
int UpLo_>
665 template<
typename MatrixType,
unsigned int UpLo>
676 template<
typename Derived>
const AbsReturnType abs() const
ColXpr col(Index i)
This is the const version of col().
RealReturnType real() const
#define EIGEN_GENERIC_PUBLIC_INTERFACE(Derived)
#define EIGEN_DEVICE_FUNC
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
#define EIGEN_STATIC_ASSERT_NON_INTEGER(TYPE)
Matrix< float, 1, Dynamic > MatrixType
Expression of a fixed-size or dynamic-size block.
NumTraits< Scalar >::Real RealScalar
internal::traits< Derived >::Scalar Scalar
EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Expression of a diagonal/subdiagonal/superdiagonal in a matrix.
Robust Cholesky decomposition of a matrix with pivoting.
LDLT & compute(const EigenBase< InputType > &matrix)
const TranspositionType & transpositionsP() const
internal::LDLT_Traits< MatrixType, UpLo > Traits
Traits::MatrixL matrixL() const
Diagonal< const MatrixType > vectorD() const
const Solve< LDLT, Rhs > solve(const MatrixBase< Rhs > &b) const
internal::SignMatrix m_sign
const MatrixType & matrixLDLT() const
TranspositionType m_transpositions
Transpositions< RowsAtCompileTime, MaxRowsAtCompileTime > TranspositionType
bool isNegative(void) const
LDLT()
Default Constructor.
EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
LDLT(const EigenBase< InputType > &matrix)
Constructor with decomposition.
LDLT(Index size)
Default Constructor with memory preallocation.
LDLT & rankUpdate(const MatrixBase< Derived > &w, const RealScalar &alpha=1)
LDLT(EigenBase< InputType > &matrix)
Constructs a LDLT factorization from a given matrix.
Matrix< Scalar, RowsAtCompileTime, 1, 0, MaxRowsAtCompileTime, 1 > TmpMatrixType
TmpMatrixType m_temporary
EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
MatrixType reconstructedMatrix() const
ComputationInfo info() const
Reports whether previous computation was successful.
Traits::MatrixU matrixU() const
bool solveInPlace(MatrixBase< Derived > &bAndX) const
const LDLT & adjoint() const
PermutationMatrix< RowsAtCompileTime, MaxRowsAtCompileTime > PermutationType
Base class for all dense matrices, vectors, and expressions.
const LDLT< PlainObject > ldlt() const
constexpr void resize(Index rows, Index cols)
const LDLT< PlainObject, UpLo > ldlt() const
Pseudo expression representing a solving operation.
A base class for matrix decomposition and solvers.
internal::traits< LDLT< MatrixType_, UpLo_ > >::Scalar Scalar
LDLT< MatrixType_, UpLo_ > & derived()
Transpose< TranspositionsBase > transpose() const
void resize(Index newSize)
StorageIndex & coeffRef(Index i)
IndicesType::Scalar StorageIndex
static const Eigen::internal::all_t all
bfloat16() min(const bfloat16 &a, const bfloat16 &b)
Decomposition::RealScalar rcond_estimate_helper(typename Decomposition::RealScalar matrix_norm, const Decomposition &dec)
Reciprocal condition number estimator.
void swap(scoped_array< T > &a, scoped_array< T > &b)
EIGEN_ALWAYS_INLINE bool() isfinite(const Eigen::bfloat16 &h)
bool is_exactly_zero(const X &x)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_sign_op< typename Derived::Scalar >, const Derived > sign(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_conjugate_op< typename Derived::Scalar >, const Derived > conj(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_isfinite_op< typename Derived::Scalar >, const Derived > isfinite(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_abs_op< typename Derived::Scalar >, const Derived > abs(const Eigen::ArrayBase< Derived > &x)
Eigen::Index Index
The interface type of indices.
EIGEN_CONSTEXPR Index size() const EIGEN_NOEXCEPT
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.