diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h b/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h index d67ded7ba..05df5a102 100644 --- a/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h +++ b/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h @@ -392,17 +392,14 @@ template struct MatrixExponentialReturnValue template inline void evalTo(ResultType& result) const { - const typename Derived::PlainObject srcEvaluated = m_src.eval(); - internal::matrix_exp_compute(srcEvaluated, result); + internal::matrix_exp_compute(m_src, result); } Index rows() const { return m_src.rows(); } Index cols() const { return m_src.cols(); } protected: - const Derived& m_src; - private: - MatrixExponentialReturnValue& operator=(const MatrixExponentialReturnValue&); + 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 a5675228e..f619d8ae5 100644 --- a/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h +++ b/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h @@ -481,11 +481,15 @@ template class MatrixFunctionReturnValue : public ReturnByValue > { public: - typedef typename Derived::Scalar Scalar; typedef typename Derived::Index Index; typedef typename internal::stem_function::type StemFunction; + protected: + typedef typename internal::nested::type DerivedNested; + + public: + /** \brief Constructor. * * \param[in] A %Matrix (expression) forming the argument of the matrix function. @@ -500,26 +504,25 @@ template class MatrixFunctionReturnValue template inline void evalTo(ResultType& result) const { - typedef typename Derived::PlainObject PlainObject; - typedef internal::traits Traits; + typedef typename internal::remove_all::type DerivedNestedClean; + typedef internal::traits Traits; static const int RowsAtCompileTime = Traits::RowsAtCompileTime; static const int ColsAtCompileTime = Traits::ColsAtCompileTime; - static const int Options = PlainObject::Options; + static const int Options = DerivedNestedClean::Options; typedef std::complex::Real> ComplexScalar; typedef Matrix DynMatrixType; typedef internal::MatrixFunctionAtomic AtomicType; AtomicType atomic(m_f); - const PlainObject Aevaluated = m_A.eval(); - internal::matrix_function_compute::run(Aevaluated, atomic, result); + internal::matrix_function_compute::run(m_A, atomic, result); } Index rows() const { return m_A.rows(); } Index cols() const { return m_A.cols(); } private: - typename internal::nested::type m_A; + const DerivedNested m_A; StemFunction *m_f; }; diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h b/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h index 6f84a31bd..6248eeec7 100644 --- a/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h +++ b/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h @@ -1,7 +1,7 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2011 Jitse Niesen +// Copyright (C) 2011, 2013 Jitse Niesen // Copyright (C) 2011 Chen-Pang He // // This Source Code Form is subject to the terms of the Mozilla @@ -306,10 +306,14 @@ template class MatrixLogarithmReturnValue : public ReturnByValue > { public: - typedef typename Derived::Scalar Scalar; typedef typename Derived::Index Index; +protected: + typedef typename internal::nested::type DerivedNested; + +public: + /** \brief Constructor. * * \param[in] A %Matrix (expression) forming the argument of the matrix logarithm. @@ -323,25 +327,24 @@ public: template inline void evalTo(ResultType& result) const { - typedef typename Derived::PlainObject PlainObject; - typedef internal::traits Traits; + typedef typename internal::remove_all::type DerivedNestedClean; + typedef internal::traits Traits; static const int RowsAtCompileTime = Traits::RowsAtCompileTime; static const int ColsAtCompileTime = Traits::ColsAtCompileTime; - static const int Options = PlainObject::Options; + static const int Options = DerivedNestedClean::Options; typedef std::complex::Real> ComplexScalar; typedef Matrix DynMatrixType; typedef internal::MatrixLogarithmAtomic AtomicType; AtomicType atomic; - const PlainObject Aevaluated = m_A.eval(); - internal::matrix_function_compute::run(Aevaluated, atomic, result); + internal::matrix_function_compute::run(m_A, atomic, result); } Index rows() const { return m_A.rows(); } Index cols() const { return m_A.cols(); } private: - typename internal::nested::type m_A; + const DerivedNested m_A; }; namespace internal { diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h b/unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h index 314b3f38e..8ca4f4864 100644 --- a/unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h +++ b/unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h @@ -318,7 +318,10 @@ struct matrix_sqrt_compute template class MatrixSquareRootReturnValue : public ReturnByValue > { + protected: typedef typename Derived::Index Index; + typedef typename internal::nested::type DerivedNested; + public: /** \brief Constructor. * @@ -335,16 +338,15 @@ template class MatrixSquareRootReturnValue template inline void evalTo(ResultType& result) const { - typedef typename Derived::PlainObject PlainObject; - const PlainObject srcEvaluated = m_src.eval(); - internal::matrix_sqrt_compute::run(srcEvaluated, result); + typedef typename internal::remove_all::type DerivedNestedClean; + internal::matrix_sqrt_compute::run(m_src, result); } Index rows() const { return m_src.rows(); } Index cols() const { return m_src.cols(); } protected: - const Derived& m_src; + const DerivedNested m_src; }; namespace internal {