From 8f4d93a4b7b15fdd240f4c3c283128cead6eae16 Mon Sep 17 00:00:00 2001 From: Hauke Heibel Date: Fri, 2 Aug 2013 22:40:36 +0200 Subject: [PATCH] Fix compilation. The Matrix is required to be mutable but it also needs to be a reference and temporaries do not bind to non-const references - thus we need a hack and cast away the constness. --- .../Eigen/src/MatrixFunctions/MatrixFunction.h | 1 - unsupported/test/matrix_power.cpp | 12 ++++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h b/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h index f619d8ae5..a35c11be5 100644 --- a/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h +++ b/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h @@ -426,7 +426,6 @@ struct matrix_function_compute static void run(const MatrixType& A, AtomicType& atomic, ResultType &result) { typedef internal::traits Traits; - typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Index Index; // compute Schur decomposition of A diff --git a/unsupported/test/matrix_power.cpp b/unsupported/test/matrix_power.cpp index 58644f84b..baf183d12 100644 --- a/unsupported/test/matrix_power.cpp +++ b/unsupported/test/matrix_power.cpp @@ -97,8 +97,12 @@ void testGeneral(const MatrixType& m, double tol) } template -void testSingular(const MatrixType& m, double tol) +void testSingular(const MatrixType& m_const, double tol) { + // we need to pass by reference in order to prevent errors with + // MSVC for aligned data types ... + MatrixType& m = const_cast(m_const); + const int IsComplex = NumTraits::Scalar>::IsComplex; typedef typename internal::conditional, const MatrixType&>::type TriangularType; typename internal::conditional< IsComplex, ComplexSchur, RealSchur >::type schur; @@ -126,8 +130,12 @@ void testSingular(const MatrixType& m, double tol) } template -void testLogThenExp(const MatrixType& m, double tol) +void testLogThenExp(const MatrixType& m_const, double tol) { + // we need to pass by reference in order to prevent errors with + // MSVC for aligned data types ... + MatrixType& m = const_cast(m_const); + typedef typename MatrixType::Scalar Scalar; Scalar x;