diff options
author | 2012-09-22 22:06:22 +0800 | |
---|---|---|
committer | 2012-09-22 22:06:22 +0800 | |
commit | 7e64f78f65db6681e6f71b80fa84c57bbce8200f (patch) | |
tree | 203f607a2c51eadccbfcc8f6ce0daa180c34eb2e /unsupported | |
parent | d7b1049cab438b75576f2c98254684c8a3352666 (diff) |
Avoid inefficient 2x2 LU
Diffstat (limited to 'unsupported')
-rw-r--r-- | unsupported/Eigen/src/MatrixFunctions/MatrixPower.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h b/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h index 2ed319641..08affb2b5 100644 --- a/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h +++ b/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h @@ -226,7 +226,7 @@ void MatrixPower<MatrixType>::computeIntPower(const PlainObject& b, ResultType& else if (p>0) { m_tmp1 = m_A; } - else if (b.cols() * (pp - applyings) <= m_A.cols() * squarings) { + else if (m_A.cols() > 2 && b.cols()*(pp-applyings) <= m_A.cols()*squarings) { PartialPivLU<MatrixType> A(m_A); res = A.solve(b); for (--pp; pp >= 1; --pp) @@ -237,7 +237,7 @@ void MatrixPower<MatrixType>::computeIntPower(const PlainObject& b, ResultType& m_tmp1 = m_A.inverse(); } - while (b.cols() * (pp - applyings) > m_A.cols() * squarings) { + while (b.cols()*(pp-applyings) > m_A.cols()*squarings) { if (std::fmod(pp, 2) >= 1) { apply(b, res, init); --applyings; |