19 template<
typename MatrixType_,
int UpLo_>
struct traits<LLT<MatrixType_, UpLo_> >
22 typedef MatrixXpr XprKind;
23 typedef SolverStorage StorageKind;
24 typedef int StorageIndex;
28 template<
typename MatrixType,
int UpLo>
struct LLT_Traits;
68 template<
typename MatrixType_,
int UpLo_>
class LLT
87 typedef internal::LLT_Traits<MatrixType,UpLo>
Traits;
106 template<
typename InputType>
121 template<
typename InputType>
130 inline typename Traits::MatrixU
matrixU()
const
137 inline typename Traits::MatrixL
matrixL()
const
143 #ifdef EIGEN_PARSED_BY_DOXYGEN
154 template<
typename Rhs>
159 template<
typename Derived>
162 template<
typename InputType>
209 template<
typename VectorType>
212 #ifndef EIGEN_PARSED_BY_DOXYGEN
213 template<
typename RhsType,
typename DstType>
214 void _solve_impl(
const RhsType &rhs, DstType &dst)
const;
216 template<
bool Conjugate,
typename RhsType,
typename DstType>
217 void _solve_impl_transposed(
const RhsType &rhs, DstType &dst)
const;
236 template<
typename Scalar,
int UpLo>
struct llt_inplace;
238 template<
typename MatrixType,
typename VectorType>
242 typedef typename MatrixType::Scalar
Scalar;
244 typedef typename MatrixType::ColXpr ColXpr;
246 typedef typename ColXprCleaned::SegmentReturnType ColXprSegment;
248 typedef typename TempVectorType::SegmentReturnType TempVecSegment;
260 temp =
sqrt(sigma) * vec;
270 ColXprSegment
x(
mat.col(
i).tail(rs));
271 TempVecSegment
y(temp.tail(rs));
286 RealScalar gamma = dj*beta + swj2;
288 RealScalar
x = dj + swj2/beta;
289 if (
x<=RealScalar(0))
291 RealScalar nLjj =
sqrt(
x);
292 mat.coeffRef(
j,
j) = nLjj;
299 temp.tail(rs) -= (wj/Ljj) *
mat.col(
j).tail(rs);
301 mat.col(
j).tail(rs) = (nLjj/Ljj) *
mat.col(
j).tail(rs) + (nLjj * sigma*
numext::conj(wj)/gamma)*temp.tail(rs);
308 template<
typename Scalar>
struct llt_inplace<
Scalar,
Lower>
311 template<
typename MatrixType>
327 if (k>0)
x -= A10.squaredNorm();
328 if (
x<=RealScalar(0))
331 if (k>0 && rs>0) A21.noalias() -= A20 * A10.adjoint();
337 template<
typename MatrixType>
346 blockSize = (blockSize/16)*16;
357 Block<MatrixType,Dynamic,Dynamic> A11(
m,k, k, bs,bs);
358 Block<MatrixType,Dynamic,Dynamic> A21(
m,k+bs,k, rs,bs);
362 if((ret=unblocked(A11))>=0)
return k+ret;
363 if(rs>0) A11.adjoint().template triangularView<Upper>().template solveInPlace<OnTheRight>(A21);
369 template<
typename MatrixType,
typename VectorType>
376 template<
typename Scalar>
struct llt_inplace<
Scalar,
Upper>
380 template<
typename MatrixType>
383 Transpose<MatrixType> matt(
mat);
384 return llt_inplace<Scalar, Lower>::unblocked(matt);
386 template<
typename MatrixType>
389 Transpose<MatrixType> matt(
mat);
390 return llt_inplace<Scalar, Lower>::blocked(matt);
392 template<
typename MatrixType,
typename VectorType>
395 Transpose<MatrixType> matt(
mat);
396 return llt_inplace<Scalar, Lower>::rankUpdate(matt, vec.conjugate(), sigma);
402 typedef const TriangularView<const MatrixType, Lower> MatrixL;
403 typedef const TriangularView<const typename MatrixType::AdjointReturnType, Upper> MatrixU;
404 static inline MatrixL getL(
const MatrixType&
m) {
return MatrixL(
m); }
405 static inline MatrixU getU(
const MatrixType&
m) {
return MatrixU(
m.adjoint()); }
407 {
return llt_inplace<typename MatrixType::Scalar, Lower>::blocked(
m)==-1; }
412 typedef const TriangularView<const typename MatrixType::AdjointReturnType, Lower> MatrixL;
413 typedef const TriangularView<const MatrixType, Upper> MatrixU;
414 static inline MatrixL getL(
const MatrixType&
m) {
return MatrixL(
m.adjoint()); }
415 static inline MatrixU getU(
const MatrixType&
m) {
return MatrixU(
m); }
417 {
return llt_inplace<typename MatrixType::Scalar, Upper>::blocked(
m)==-1; }
429 template<
typename MatrixType,
int UpLo_>
430 template<
typename InputType>
443 RealScalar abs_col_sum;
453 bool ok = Traits::inplace_decomposition(
m_matrix);
464 template<
typename MatrixType_,
int UpLo_>
465 template<
typename VectorType>
471 if(internal::llt_inplace<typename MatrixType::Scalar, UpLo>::rankUpdate(
m_matrix,
v,sigma)>=0)
479 #ifndef EIGEN_PARSED_BY_DOXYGEN
480 template<
typename MatrixType_,
int UpLo_>
481 template<
typename RhsType,
typename DstType>
484 _solve_impl_transposed<true>(rhs, dst);
487 template<
typename MatrixType_,
int UpLo_>
488 template<
bool Conjugate,
typename RhsType,
typename DstType>
489 void LLT<MatrixType_,UpLo_>::_solve_impl_transposed(
const RhsType &rhs, DstType &dst)
const
493 matrixL().template conjugateIf<!Conjugate>().solveInPlace(dst);
494 matrixU().template conjugateIf<!Conjugate>().solveInPlace(dst);
511 template<
typename MatrixType,
int UpLo_>
512 template<
typename Derived>
524 template<
typename MatrixType,
int UpLo_>
535 template<
typename Derived>
546 template<
typename MatrixType,
unsigned int UpLo>
const SqrtReturnType sqrt() const
Array< int, Dynamic, 1 > v
ColXpr col(Index i)
This is the const version of col().
RealReturnType real() const
#define EIGEN_GENERIC_PUBLIC_INTERFACE(Derived)
#define EIGEN_STATIC_ASSERT_NON_INTEGER(TYPE)
#define EIGEN_STATIC_ASSERT_VECTOR_ONLY(TYPE)
Matrix< float, 1, Dynamic > MatrixType
Expression of a fixed-size or dynamic-size block.
NumTraits< Scalar >::Real RealScalar
EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Rotation given by a cosine-sine pair.
void makeGivens(const Scalar &p, const Scalar &q, Scalar *r=0)
Standard Cholesky decomposition (LL^T) of a matrix and associated features.
LLT & compute(const EigenBase< InputType > &matrix)
ComputationInfo info() const
Reports whether previous computation was successful.
EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
LLT(Index size)
Default Constructor with memory preallocation.
LLT & rankUpdate(const VectorType &vec, const RealScalar &sigma=1)
EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
LLT(EigenBase< InputType > &matrix)
Constructs a LLT factorization from a given matrix.
const LLT & adjoint() const EIGEN_NOEXCEPT
internal::LLT_Traits< MatrixType, UpLo > Traits
void solveInPlace(const MatrixBase< Derived > &bAndX) const
const Solve< LLT, Rhs > solve(const MatrixBase< Rhs > &b) const
const MatrixType & matrixLLT() const
Traits::MatrixU matrixU() const
LLT(const EigenBase< InputType > &matrix)
LLT()
Default Constructor.
MatrixType reconstructedMatrix() const
Traits::MatrixL matrixL() const
Base class for all dense matrices, vectors, and expressions.
const LLT< PlainObject > llt() const
const LLT< PlainObject, UpLo > llt() const
Pseudo expression representing a solving operation.
A base class for matrix decomposition and solvers.
internal::traits< LLT< MatrixType_, UpLo_ > >::Scalar Scalar
LLT< MatrixType_, UpLo_ > & derived()
bfloat16() max(const bfloat16 &a, const bfloat16 &b)
bfloat16() min(const bfloat16 &a, const bfloat16 &b)
static Index llt_rank_update_lower(MatrixType &mat, const VectorType &vec, const typename MatrixType::RealScalar &sigma)
void apply_rotation_in_the_plane(DenseBase< VectorX > &xpr_x, DenseBase< VectorY > &xpr_y, const JacobiRotation< OtherScalar > &j)
typename remove_all< T >::type remove_all_t
Decomposition::RealScalar rcond_estimate_helper(typename Decomposition::RealScalar matrix_norm, const Decomposition &dec)
Reciprocal condition number estimator.
bool is_same_dense(const T1 &mat1, const T2 &mat2, std::enable_if_t< possibly_same_dense< T1, T2 >::value > *=0)
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_conjugate_op< typename Derived::Scalar >, const Derived > conj(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_sqrt_op< typename Derived::Scalar >, const Derived > sqrt(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.