Use more .noalias()

This commit is contained in:
Markus Vieth
2025-03-17 19:32:43 +01:00
parent 14f845a1a8
commit 0259a52b0e
6 changed files with 15 additions and 14 deletions

View File

@@ -449,23 +449,23 @@ inline void RealQZ<MatrixType>::step(Index f, Index l, Index iter) {
Index lr = (std::min)(k + 4, dim); // last row to update
Map<Matrix<Scalar, Dynamic, 1> > tmp(m_workspace.data(), lr);
// S
tmp = m_S.template middleCols<2>(k).topRows(lr) * essential2;
tmp.noalias() = m_S.template middleCols<2>(k).topRows(lr) * essential2;
tmp += m_S.col(k + 2).head(lr);
m_S.col(k + 2).head(lr) -= tau * tmp;
m_S.template middleCols<2>(k).topRows(lr) -= (tau * tmp) * essential2.adjoint();
m_S.template middleCols<2>(k).topRows(lr).noalias() -= (tau * tmp) * essential2.adjoint();
// T
tmp = m_T.template middleCols<2>(k).topRows(lr) * essential2;
tmp += m_T.col(k + 2).head(lr);
m_T.col(k + 2).head(lr) -= tau * tmp;
m_T.template middleCols<2>(k).topRows(lr) -= (tau * tmp) * essential2.adjoint();
m_T.template middleCols<2>(k).topRows(lr).noalias() -= (tau * tmp) * essential2.adjoint();
}
if (m_computeQZ) {
// Z
Map<Matrix<Scalar, 1, Dynamic> > tmp(m_workspace.data(), dim);
tmp = essential2.adjoint() * (m_Z.template middleRows<2>(k));
tmp.noalias() = essential2.adjoint() * (m_Z.template middleRows<2>(k));
tmp += m_Z.row(k + 2);
m_Z.row(k + 2) -= tau * tmp;
m_Z.template middleRows<2>(k) -= essential2 * (tau * tmp);
m_Z.template middleRows<2>(k).noalias() -= essential2 * (tau * tmp);
}
m_T.coeffRef(k + 2, k) = m_T.coeffRef(k + 2, k + 1) = Scalar(0.0);