From 4e26057f66d62d65739557bee72f4b9ad211e495 Mon Sep 17 00:00:00 2001 From: Chen-Pang He Date: Fri, 5 Jul 2013 00:08:11 +0800 Subject: Remove unused declarations for MatrixPowerProduct. --- Eigen/src/Core/util/ForwardDeclarations.h | 1 - 1 file changed, 1 deletion(-) (limited to 'Eigen/src/Core/util') diff --git a/Eigen/src/Core/util/ForwardDeclarations.h b/Eigen/src/Core/util/ForwardDeclarations.h index d6a814586..7dc87968c 100644 --- a/Eigen/src/Core/util/ForwardDeclarations.h +++ b/Eigen/src/Core/util/ForwardDeclarations.h @@ -271,7 +271,6 @@ template class MatrixFunctionReturnValue; template class MatrixSquareRootReturnValue; template class MatrixLogarithmReturnValue; template class MatrixPowerReturnValue; -template class MatrixPowerProduct; namespace internal { template -- cgit v1.2.3 From 04a9ad6e10a5b216c868d1f182380ac079be9837 Mon Sep 17 00:00:00 2001 From: Chen-Pang He Date: Fri, 5 Jul 2013 00:28:28 +0800 Subject: Let complex power fall back to "log, scale, exp". --- Eigen/src/Core/MatrixBase.h | 1 + Eigen/src/Core/util/ForwardDeclarations.h | 1 + .../Eigen/src/MatrixFunctions/MatrixPower.h | 32 ++++++++++++++++++++++ 3 files changed, 34 insertions(+) (limited to 'Eigen/src/Core/util') diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h index 84b83ffdf..0628ebd1f 100644 --- a/Eigen/src/Core/MatrixBase.h +++ b/Eigen/src/Core/MatrixBase.h @@ -455,6 +455,7 @@ template class MatrixBase const MatrixSquareRootReturnValue sqrt() const; const MatrixLogarithmReturnValue log() const; const MatrixPowerReturnValue pow(const RealScalar& p) const; + const MatrixComplexPowerReturnValue pow(const std::complex& p) const; #ifdef EIGEN2_SUPPORT template diff --git a/Eigen/src/Core/util/ForwardDeclarations.h b/Eigen/src/Core/util/ForwardDeclarations.h index 7dc87968c..cbedb7da4 100644 --- a/Eigen/src/Core/util/ForwardDeclarations.h +++ b/Eigen/src/Core/util/ForwardDeclarations.h @@ -271,6 +271,7 @@ template class MatrixFunctionReturnValue; template class MatrixSquareRootReturnValue; template class MatrixLogarithmReturnValue; template class MatrixPowerReturnValue; +template class MatrixComplexPowerReturnValue; namespace internal { template diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h b/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h index 18f6703b6..a49db1916 100644 --- a/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h +++ b/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h @@ -503,6 +503,30 @@ class MatrixPowerReturnValue : public ReturnByValue< MatrixPowerReturnValue +class MatrixComplexPowerReturnValue : public ReturnByValue< MatrixComplexPowerReturnValue > +{ + public: + typedef typename Derived::PlainObject PlainObject; + typedef typename std::complex ComplexScalar; + typedef typename Derived::Index Index; + + MatrixComplexPowerReturnValue(const Derived& A, const ComplexScalar& p) : m_A(A), m_p(p) + { } + + template + inline void evalTo(ResultType& res) const + { res = (m_p * m_A.log()).exp(); } + + Index rows() const { return m_A.rows(); } + Index cols() const { return m_A.cols(); } + + private: + const Derived& m_A; + const ComplexScalar m_p; + MatrixComplexPowerReturnValue& operator=(const MatrixComplexPowerReturnValue&); +}; + namespace internal { template @@ -513,12 +537,20 @@ template struct traits< MatrixPowerReturnValue > { typedef typename Derived::PlainObject ReturnType; }; +template +struct traits< MatrixComplexPowerReturnValue > +{ typedef typename Derived::PlainObject ReturnType; }; + } template const MatrixPowerReturnValue MatrixBase::pow(const RealScalar& p) const { return MatrixPowerReturnValue(derived(), p); } +template +const MatrixComplexPowerReturnValue MatrixBase::pow(const std::complex& p) const +{ return MatrixComplexPowerReturnValue(derived(), p); } + } // namespace Eigen #endif // EIGEN_MATRIX_POWER -- cgit v1.2.3