aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2012-04-10 15:40:36 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2012-04-10 15:40:36 +0200
commitb0cf95619e0777194fcc2d1337a39ef5357a4233 (patch)
tree7396c2cbbaf566eea6e705f1babe7748465ca033
parent311c5b87a3cba60dd83273212228b5ce800d398c (diff)
fix compilation of "somedensematrix.llt().matrixL().transpose()" (missing constness on the return types)
-rw-r--r--Eigen/src/Cholesky/LDLT.h8
-rw-r--r--Eigen/src/Cholesky/LLT.h8
-rw-r--r--Eigen/src/Cholesky/LLT_MKL.h2
-rw-r--r--test/cholesky.cpp10
4 files changed, 19 insertions, 9 deletions
diff --git a/Eigen/src/Cholesky/LDLT.h b/Eigen/src/Cholesky/LDLT.h
index e93c27e50..e9d30ac31 100644
--- a/Eigen/src/Cholesky/LDLT.h
+++ b/Eigen/src/Cholesky/LDLT.h
@@ -419,16 +419,16 @@ template<> struct ldlt_inplace<Upper>
template<typename MatrixType> struct LDLT_Traits<MatrixType,Lower>
{
- typedef TriangularView<const MatrixType, UnitLower> MatrixL;
- typedef TriangularView<const typename MatrixType::AdjointReturnType, UnitUpper> MatrixU;
+ typedef const TriangularView<const MatrixType, UnitLower> MatrixL;
+ typedef const TriangularView<const typename MatrixType::AdjointReturnType, UnitUpper> MatrixU;
static inline MatrixL getL(const MatrixType& m) { return m; }
static inline MatrixU getU(const MatrixType& m) { return m.adjoint(); }
};
template<typename MatrixType> struct LDLT_Traits<MatrixType,Upper>
{
- typedef TriangularView<const typename MatrixType::AdjointReturnType, UnitLower> MatrixL;
- typedef TriangularView<const MatrixType, UnitUpper> MatrixU;
+ typedef const TriangularView<const typename MatrixType::AdjointReturnType, UnitLower> MatrixL;
+ typedef const TriangularView<const MatrixType, UnitUpper> MatrixU;
static inline MatrixL getL(const MatrixType& m) { return m.adjoint(); }
static inline MatrixU getU(const MatrixType& m) { return m; }
};
diff --git a/Eigen/src/Cholesky/LLT.h b/Eigen/src/Cholesky/LLT.h
index 84c91fc5d..3dcd4b604 100644
--- a/Eigen/src/Cholesky/LLT.h
+++ b/Eigen/src/Cholesky/LLT.h
@@ -365,8 +365,8 @@ template<typename Scalar> struct llt_inplace<Scalar, Upper>
template<typename MatrixType> struct LLT_Traits<MatrixType,Lower>
{
- typedef TriangularView<const MatrixType, Lower> MatrixL;
- typedef TriangularView<const typename MatrixType::AdjointReturnType, Upper> MatrixU;
+ typedef const TriangularView<const MatrixType, Lower> MatrixL;
+ typedef const TriangularView<const typename MatrixType::AdjointReturnType, Upper> MatrixU;
static inline MatrixL getL(const MatrixType& m) { return m; }
static inline MatrixU getU(const MatrixType& m) { return m.adjoint(); }
static bool inplace_decomposition(MatrixType& m)
@@ -375,8 +375,8 @@ template<typename MatrixType> struct LLT_Traits<MatrixType,Lower>
template<typename MatrixType> struct LLT_Traits<MatrixType,Upper>
{
- typedef TriangularView<const typename MatrixType::AdjointReturnType, Lower> MatrixL;
- typedef TriangularView<const MatrixType, Upper> MatrixU;
+ typedef const TriangularView<const typename MatrixType::AdjointReturnType, Lower> MatrixL;
+ typedef const TriangularView<const MatrixType, Upper> MatrixU;
static inline MatrixL getL(const MatrixType& m) { return m.adjoint(); }
static inline MatrixU getU(const MatrixType& m) { return m; }
static bool inplace_decomposition(MatrixType& m)
diff --git a/Eigen/src/Cholesky/LLT_MKL.h b/Eigen/src/Cholesky/LLT_MKL.h
index 10aa746dc..7f7549bb0 100644
--- a/Eigen/src/Cholesky/LLT_MKL.h
+++ b/Eigen/src/Cholesky/LLT_MKL.h
@@ -71,7 +71,7 @@ template<> struct llt_inplace<EIGTYPE, Lower> \
} \
template<typename MatrixType, typename VectorType> \
static typename MatrixType::Index rankUpdate(MatrixType& mat, const VectorType& vec, const typename MatrixType::RealScalar& sigma) \
- { return llt_rank_update_lower(mat, vec, sigma); } \
+ { return Eigen::internal::llt_rank_update_lower(mat, vec, sigma); } \
}; \
template<> struct llt_inplace<EIGTYPE, Upper> \
{ \
diff --git a/test/cholesky.cpp b/test/cholesky.cpp
index 1a1b2eeb5..4f2516d26 100644
--- a/test/cholesky.cpp
+++ b/test/cholesky.cpp
@@ -124,6 +124,11 @@ template<typename MatrixType> void cholesky(const MatrixType& m)
MatrixType neg = -symmLo;
chollo.compute(neg);
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
@@ -152,6 +157,11 @@ template<typename MatrixType> void cholesky(const MatrixType& m)
matX = ldltup.solve(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)
{
// note : each inplace permutation requires a small temporary vector (mask)