From 84bb868f07361af7991abd1f0cdb8017af96c0a5 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Fri, 19 Dec 2008 02:59:04 +0000 Subject: [PATCH] * more MSVC warning fixes from Kenneth Riddile * actually GCC 4.3.0 has a bug, "deprecated" placed at the end of a function prototype doesn't have any effect, moving them to the start of the function prototype makes it actually work! * finish porting the cholesky unit-test to the new LLT/LDLT, after the above fix revealed a deprecated warning --- Eigen/src/Cholesky/Cholesky.h | 2 +- Eigen/src/Cholesky/CholeskyWithoutSquareRoot.h | 2 +- Eigen/src/Core/MatrixBase.h | 7 ++++++- Eigen/src/Core/util/DisableMSVCWarnings.h | 2 +- test/cholesky.cpp | 4 ++-- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Eigen/src/Cholesky/Cholesky.h b/Eigen/src/Cholesky/Cholesky.h index 69e906ee7..bbf24fab3 100644 --- a/Eigen/src/Cholesky/Cholesky.h +++ b/Eigen/src/Cholesky/Cholesky.h @@ -58,7 +58,7 @@ template class Cholesky inline bool isPositiveDefinite(void) const { return m_isPositiveDefinite; } template - typename MatrixBase::PlainMatrixType_ColMajor solve(const MatrixBase &b) const EIGEN_DEPRECATED; + EIGEN_DEPRECATED typename MatrixBase::PlainMatrixType_ColMajor solve(const MatrixBase &b) const; template bool solve(const MatrixBase &b, MatrixBase *result) const; diff --git a/Eigen/src/Cholesky/CholeskyWithoutSquareRoot.h b/Eigen/src/Cholesky/CholeskyWithoutSquareRoot.h index b40ba18c0..0f3e9e07f 100644 --- a/Eigen/src/Cholesky/CholeskyWithoutSquareRoot.h +++ b/Eigen/src/Cholesky/CholeskyWithoutSquareRoot.h @@ -55,7 +55,7 @@ template class CholeskyWithoutSquareRoot inline bool isPositiveDefinite(void) const { return m_isPositiveDefinite; } template - typename Derived::Eval solve(const MatrixBase &b) const EIGEN_DEPRECATED; + EIGEN_DEPRECATED typename Derived::Eval solve(const MatrixBase &b) const; template bool solve(const MatrixBase &b, MatrixBase *result) const; diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h index bb3cc0532..0c3a04ff4 100644 --- a/Eigen/src/Core/MatrixBase.h +++ b/Eigen/src/Core/MatrixBase.h @@ -495,7 +495,12 @@ template class MatrixBase * Notice that in the case of a plain matrix or vector (not an expression) this function just returns * a const reference, in order to avoid a useless copy. */ - EIGEN_ALWAYS_INLINE const typename ei_eval::type eval() const + #ifdef _MSC_VER + inline // MSVC 2008 can't force-inline this method and emits a warning, so do just 'inline' + #else + EIGEN_ALWAYS_INLINE + #endif + const typename ei_eval::type eval() const { return typename ei_eval::type(derived()); } diff --git a/Eigen/src/Core/util/DisableMSVCWarnings.h b/Eigen/src/Core/util/DisableMSVCWarnings.h index 8152db5ff..e6c653d70 100644 --- a/Eigen/src/Core/util/DisableMSVCWarnings.h +++ b/Eigen/src/Core/util/DisableMSVCWarnings.h @@ -3,7 +3,7 @@ #ifdef _MSC_VER #pragma warning( push ) - #pragma warning( disable : 4181 4244 4127 ) + #pragma warning( disable : 4181 4244 4127 4211 ) #endif #endif // EIGEN_DISABLEMSVCWARNINGS_H \ No newline at end of file diff --git a/test/cholesky.cpp b/test/cholesky.cpp index a64a45c45..eb613cd6a 100644 --- a/test/cholesky.cpp +++ b/test/cholesky.cpp @@ -63,9 +63,9 @@ template void cholesky(const MatrixType& m) convert(vecB, gVecX); Gsl::cholesky(gMatA); Gsl::cholesky_solve(gMatA, gVecB, gVecX); - VectorType vecX, _vecX, _vecB; + VectorType vecX(rows), _vecX, _vecB; convert(gVecX, _vecX); - vecX.set( symm.cholesky().solve(vecB) ); + symm.llt().solve(vecB, &vecX); Gsl::prod(gSymm, gVecX, gVecB); convert(gVecB, _vecB); // test gsl itself !