Optimize extraction of Q in SparseQR by exploiting the structure of the identity matrix.

This commit is contained in:
Gael Guennebaud 2018-07-11 14:01:47 +02:00
parent 1625476091
commit f00d08cc0a

View File

@ -640,7 +640,8 @@ struct SparseQR_QProduct : ReturnByValue<SparseQR_QProduct<SparseQRType, Derived
// Compute res = Q * other column by column
for(Index j = 0; j < res.cols(); j++)
{
for (Index k = diagSize-1; k >=0; k--)
Index start_k = internal::is_identity<Derived>::value ? numext::mini(j,diagSize-1) : diagSize-1;
for (Index k = start_k; k >=0; k--)
{
Scalar tau = Scalar(0);
tau = m_qr.m_Q.col(k).dot(res.col(j));