mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-04 18:54:00 +08:00
Avoid inefficient 2x2 LU
This commit is contained in:
parent
d7b1049cab
commit
7e64f78f65
@ -226,7 +226,7 @@ void MatrixPower<MatrixType>::computeIntPower(const PlainObject& b, ResultType&
|
|||||||
else if (p>0) {
|
else if (p>0) {
|
||||||
m_tmp1 = m_A;
|
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);
|
PartialPivLU<MatrixType> A(m_A);
|
||||||
res = A.solve(b);
|
res = A.solve(b);
|
||||||
for (--pp; pp >= 1; --pp)
|
for (--pp; pp >= 1; --pp)
|
||||||
@ -237,7 +237,7 @@ void MatrixPower<MatrixType>::computeIntPower(const PlainObject& b, ResultType&
|
|||||||
m_tmp1 = m_A.inverse();
|
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) {
|
if (std::fmod(pp, 2) >= 1) {
|
||||||
apply(b, res, init);
|
apply(b, res, init);
|
||||||
--applyings;
|
--applyings;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user