mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-14 20:56:00 +08:00
fix compilation of "somedensematrix.llt().matrixL().transpose()" (missing constness on the return types)
(transplanted from b0cf95619e0777194fcc2d1337a39ef5357a4233 )
This commit is contained in:
parent
360a79d6f8
commit
ea1ac035ce
@ -331,16 +331,16 @@ template<> struct ldlt_inplace<Upper>
|
|||||||
|
|
||||||
template<typename MatrixType> struct LDLT_Traits<MatrixType,Lower>
|
template<typename MatrixType> struct LDLT_Traits<MatrixType,Lower>
|
||||||
{
|
{
|
||||||
typedef TriangularView<MatrixType, UnitLower> MatrixL;
|
typedef const TriangularView<const MatrixType, UnitLower> MatrixL;
|
||||||
typedef TriangularView<typename MatrixType::AdjointReturnType, UnitUpper> MatrixU;
|
typedef const TriangularView<const typename MatrixType::AdjointReturnType, UnitUpper> MatrixU;
|
||||||
inline static MatrixL getL(const MatrixType& m) { return m; }
|
inline static MatrixL getL(const MatrixType& m) { return m; }
|
||||||
inline static MatrixU getU(const MatrixType& m) { return m.adjoint(); }
|
inline static MatrixU getU(const MatrixType& m) { return m.adjoint(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename MatrixType> struct LDLT_Traits<MatrixType,Upper>
|
template<typename MatrixType> struct LDLT_Traits<MatrixType,Upper>
|
||||||
{
|
{
|
||||||
typedef TriangularView<typename MatrixType::AdjointReturnType, UnitLower> MatrixL;
|
typedef const TriangularView<const typename MatrixType::AdjointReturnType, UnitLower> MatrixL;
|
||||||
typedef TriangularView<MatrixType, UnitUpper> MatrixU;
|
typedef const TriangularView<const MatrixType, UnitUpper> MatrixU;
|
||||||
inline static MatrixL getL(const MatrixType& m) { return m.adjoint(); }
|
inline static MatrixL getL(const MatrixType& m) { return m.adjoint(); }
|
||||||
inline static MatrixU getU(const MatrixType& m) { return m; }
|
inline static MatrixU getU(const MatrixType& m) { return m; }
|
||||||
};
|
};
|
||||||
|
@ -274,8 +274,8 @@ template<> struct llt_inplace<Upper>
|
|||||||
|
|
||||||
template<typename MatrixType> struct LLT_Traits<MatrixType,Lower>
|
template<typename MatrixType> struct LLT_Traits<MatrixType,Lower>
|
||||||
{
|
{
|
||||||
typedef TriangularView<MatrixType, Lower> MatrixL;
|
typedef const TriangularView<const MatrixType, Lower> MatrixL;
|
||||||
typedef TriangularView<typename MatrixType::AdjointReturnType, Upper> MatrixU;
|
typedef const TriangularView<const typename MatrixType::AdjointReturnType, Upper> MatrixU;
|
||||||
inline static MatrixL getL(const MatrixType& m) { return m; }
|
inline static MatrixL getL(const MatrixType& m) { return m; }
|
||||||
inline static MatrixU getU(const MatrixType& m) { return m.adjoint(); }
|
inline static MatrixU getU(const MatrixType& m) { return m.adjoint(); }
|
||||||
static bool inplace_decomposition(MatrixType& m)
|
static bool inplace_decomposition(MatrixType& m)
|
||||||
@ -284,8 +284,8 @@ template<typename MatrixType> struct LLT_Traits<MatrixType,Lower>
|
|||||||
|
|
||||||
template<typename MatrixType> struct LLT_Traits<MatrixType,Upper>
|
template<typename MatrixType> struct LLT_Traits<MatrixType,Upper>
|
||||||
{
|
{
|
||||||
typedef TriangularView<typename MatrixType::AdjointReturnType, Lower> MatrixL;
|
typedef const TriangularView<const typename MatrixType::AdjointReturnType, Lower> MatrixL;
|
||||||
typedef TriangularView<MatrixType, Upper> MatrixU;
|
typedef const TriangularView<const MatrixType, Upper> MatrixU;
|
||||||
inline static MatrixL getL(const MatrixType& m) { return m.adjoint(); }
|
inline static MatrixL getL(const MatrixType& m) { return m.adjoint(); }
|
||||||
inline static MatrixU getU(const MatrixType& m) { return m; }
|
inline static MatrixU getU(const MatrixType& m) { return m; }
|
||||||
static bool inplace_decomposition(MatrixType& m)
|
static bool inplace_decomposition(MatrixType& m)
|
||||||
|
@ -124,6 +124,11 @@ template<typename MatrixType> void cholesky(const MatrixType& m)
|
|||||||
MatrixType neg = -symmLo;
|
MatrixType neg = -symmLo;
|
||||||
chollo.compute(neg);
|
chollo.compute(neg);
|
||||||
VERIFY(chollo.info()==NumericalIssue);
|
VERIFY(chollo.info()==NumericalIssue);
|
||||||
|
|
||||||
|
VERIFY_IS_APPROX(MatrixType(chollo.matrixL().transpose().conjugate()), MatrixType(chollo.matrixU()));
|
||||||
|
VERIFY_IS_APPROX(MatrixType(chollo.matrixU().transpose().conjugate()), MatrixType(chollo.matrixL()));
|
||||||
|
VERIFY_IS_APPROX(MatrixType(cholup.matrixL().transpose().conjugate()), MatrixType(cholup.matrixU()));
|
||||||
|
VERIFY_IS_APPROX(MatrixType(cholup.matrixU().transpose().conjugate()), MatrixType(cholup.matrixL()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// LDLT
|
// LDLT
|
||||||
@ -152,6 +157,11 @@ template<typename MatrixType> void cholesky(const MatrixType& m)
|
|||||||
matX = ldltup.solve(matB);
|
matX = ldltup.solve(matB);
|
||||||
VERIFY_IS_APPROX(symm * matX, matB);
|
VERIFY_IS_APPROX(symm * matX, matB);
|
||||||
|
|
||||||
|
VERIFY_IS_APPROX(MatrixType(ldltlo.matrixL().transpose().conjugate()), MatrixType(ldltlo.matrixU()));
|
||||||
|
VERIFY_IS_APPROX(MatrixType(ldltlo.matrixU().transpose().conjugate()), MatrixType(ldltlo.matrixL()));
|
||||||
|
VERIFY_IS_APPROX(MatrixType(ldltup.matrixL().transpose().conjugate()), MatrixType(ldltup.matrixU()));
|
||||||
|
VERIFY_IS_APPROX(MatrixType(ldltup.matrixU().transpose().conjugate()), MatrixType(ldltup.matrixL()));
|
||||||
|
|
||||||
if(MatrixType::RowsAtCompileTime==Dynamic)
|
if(MatrixType::RowsAtCompileTime==Dynamic)
|
||||||
{
|
{
|
||||||
// note : each inplace permutation requires a small temporary vector (mask)
|
// note : each inplace permutation requires a small temporary vector (mask)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user