diff options
author | Chen-Pang He <jdh8@ms63.hinet.net> | 2012-10-02 19:53:38 +0800 |
---|---|---|
committer | Chen-Pang He <jdh8@ms63.hinet.net> | 2012-10-02 19:53:38 +0800 |
commit | 21c2b4e327791aaf95a2a967b0766027fc095236 (patch) | |
tree | 2154c72506ecc93678fef5a6954ac8a26e4eaeda /unsupported | |
parent | e92fe88159a762710651f1a8f9a428bc572a27df (diff) |
Make better decision on PartialPivLU vs inverse(): We have specialized inverse() only for FIXED matrices.
Diffstat (limited to 'unsupported')
-rw-r--r-- | unsupported/Eigen/src/MatrixFunctions/MatrixPower.h | 4 | ||||
-rw-r--r-- | unsupported/Eigen/src/MatrixFunctions/MatrixPowerBase.h | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h b/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h index 2cb1d95d9..520f23bff 100644 --- a/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h +++ b/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h @@ -194,7 +194,7 @@ void MatrixPowerTriangular<MatrixType>::computeIntPower(const Derived& b, Result else if (p>0) { m_tmp1 = m_T; } - else if (m_A.cols() > 2 && b.cols()*(pp-applyings) <= m_A.cols()*squarings) { + else if (m_OKforLU && b.cols()*(pp-applyings) <= m_A.cols()*squarings) { res = m_T.solve(b); for (--pp; pp >= 1; --pp) res = m_T.solve(res); @@ -424,7 +424,7 @@ void MatrixPower<MatrixType>::computeIntPower(const Derived& b, ResultType& res, else if (p>0) { m_tmp1 = m_A; } - else if (m_A.cols() > 2 && b.cols()*(pp-applyings) <= m_A.cols()*squarings) { + else if (m_OKforLU && b.cols()*(pp-applyings) <= m_A.cols()*squarings) { PartialPivLU<MatrixType> A(m_A); res = A.solve(b); for (--pp; pp >= 1; --pp) diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixPowerBase.h b/unsupported/Eigen/src/MatrixFunctions/MatrixPowerBase.h index aa28b821b..96846cb93 100644 --- a/unsupported/Eigen/src/MatrixFunctions/MatrixPowerBase.h +++ b/unsupported/Eigen/src/MatrixFunctions/MatrixPowerBase.h @@ -24,6 +24,7 @@ namespace Eigen { typedef typename Base::RealArray RealArray; #define EIGEN_MATRIX_POWER_PROTECTED_MEMBERS(Derived) \ + using Base::m_OKforLU; \ using Base::m_A; \ using Base::m_Id; \ using Base::m_tmp1; \ @@ -98,6 +99,7 @@ class MatrixPowerBase protected: typedef Array<RealScalar,RowsAtCompileTime,1,ColMajor,MaxRowsAtCompileTime> RealArray; + static const bool m_OKforLU = RowsAtCompileTime == Dynamic || RowsAtCompileTime > 4; const MatrixType& m_A; const MatrixType m_Id; |