From 62bce6e5e6da71dd8d85ae229d24b9f9f13d1681 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Thu, 18 Sep 2014 17:31:17 +0200 Subject: Make MatrixFunction use nested_eval instead of nested --- unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h | 5 +++-- unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h | 11 ++++++----- unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h | 11 ++++++----- unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h | 8 +++++--- 4 files changed, 20 insertions(+), 15 deletions(-) (limited to 'unsupported/Eigen/src/MatrixFunctions') diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h b/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h index 160120d03..9e0545660 100644 --- a/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h +++ b/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h @@ -392,14 +392,15 @@ template struct MatrixExponentialReturnValue template inline void evalTo(ResultType& result) const { - internal::matrix_exp_compute(m_src, result); + const typename internal::nested_eval::type tmp(m_src); + internal::matrix_exp_compute(tmp, result); } Index rows() const { return m_src.rows(); } Index cols() const { return m_src.cols(); } protected: - const typename internal::nested::type m_src; + const typename internal::nested::type m_src; }; namespace internal { diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h b/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h index a35c11be5..b68aae5e8 100644 --- a/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h +++ b/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h @@ -485,7 +485,7 @@ template class MatrixFunctionReturnValue typedef typename internal::stem_function::type StemFunction; protected: - typedef typename internal::nested::type DerivedNested; + typedef typename internal::nested::type DerivedNested; public: @@ -503,18 +503,19 @@ template class MatrixFunctionReturnValue template inline void evalTo(ResultType& result) const { - typedef typename internal::remove_all::type DerivedNestedClean; - typedef internal::traits Traits; + typedef typename internal::nested_eval::type NestedEvalType; + typedef typename internal::remove_all::type NestedEvalTypeClean; + typedef internal::traits Traits; static const int RowsAtCompileTime = Traits::RowsAtCompileTime; static const int ColsAtCompileTime = Traits::ColsAtCompileTime; - static const int Options = DerivedNestedClean::Options; + static const int Options = NestedEvalTypeClean::Options; typedef std::complex::Real> ComplexScalar; typedef Matrix DynMatrixType; typedef internal::MatrixFunctionAtomic AtomicType; AtomicType atomic(m_f); - internal::matrix_function_compute::run(m_A, atomic, result); + internal::matrix_function_compute::run(m_A, atomic, result); } Index rows() const { return m_A.rows(); } diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h b/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h index d46ccc145..42b60b9b1 100644 --- a/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h +++ b/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h @@ -310,7 +310,7 @@ public: typedef typename Derived::Index Index; protected: - typedef typename internal::nested::type DerivedNested; + typedef typename internal::nested::type DerivedNested; public: @@ -327,17 +327,18 @@ public: template inline void evalTo(ResultType& result) const { - typedef typename internal::remove_all::type DerivedNestedClean; - typedef internal::traits Traits; + typedef typename internal::nested_eval::type DerivedEvalType; + typedef typename internal::remove_all::type DerivedEvalTypeClean; + typedef internal::traits Traits; static const int RowsAtCompileTime = Traits::RowsAtCompileTime; static const int ColsAtCompileTime = Traits::ColsAtCompileTime; - static const int Options = DerivedNestedClean::Options; + static const int Options = DerivedEvalTypeClean::Options; typedef std::complex::Real> ComplexScalar; typedef Matrix DynMatrixType; typedef internal::MatrixLogarithmAtomic AtomicType; AtomicType atomic; - internal::matrix_function_compute::run(m_A, atomic, result); + internal::matrix_function_compute::run(m_A, atomic, result); } Index rows() const { return m_A.rows(); } diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h b/unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h index 8ca4f4864..3a4d6eb3f 100644 --- a/unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h +++ b/unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h @@ -320,7 +320,7 @@ template class MatrixSquareRootReturnValue { protected: typedef typename Derived::Index Index; - typedef typename internal::nested::type DerivedNested; + typedef typename internal::nested::type DerivedNested; public: /** \brief Constructor. @@ -338,8 +338,10 @@ template class MatrixSquareRootReturnValue template inline void evalTo(ResultType& result) const { - typedef typename internal::remove_all::type DerivedNestedClean; - internal::matrix_sqrt_compute::run(m_src, result); + typedef typename internal::nested_eval::type DerivedEvalType; + typedef typename internal::remove_all::type DerivedEvalTypeClean; + DerivedEvalType tmp(m_src); + internal::matrix_sqrt_compute::run(tmp, result); } Index rows() const { return m_src.rows(); } -- cgit v1.2.3