Save one extra temporary when assigning a sparse product to a row-major sparse matrix

This commit is contained in:
Gael Guennebaud
2020-05-30 23:14:29 +02:00
parent 95177362ed
commit ab615e4114
3 changed files with 16 additions and 1 deletions

View File

@@ -103,7 +103,7 @@ template<typename SparseMatrixType> void sparse_product()
// make sure the right product implementation is called:
if((!SparseMatrixType::IsRowMajor) && m2.rows()<=m3.cols())
{
VERIFY_EVALUATION_COUNT(m4 = m2*m3, 3); // 1 temp for the result + 2 for transposing and get a sorted result.
VERIFY_EVALUATION_COUNT(m4 = m2*m3, 2); // 2 for transposing and get a sorted result.
VERIFY_EVALUATION_COUNT(m4 = (m2*m3).pruned(0), 1);
VERIFY_EVALUATION_COUNT(m4 = (m2*m3).eval().pruned(0), 4);
}