bug #37: fix resizing when the destination sparse matrix is row major

This commit is contained in:
Oliver Ruepp 2011-03-08 16:37:59 +01:00
parent c6c6c34909
commit 5d1263e7c5

View File

@ -133,7 +133,12 @@ static void sparse_product_impl(const Lhs& lhs, const Rhs& rhs, ResultType& res)
float avgNnzPerRhsColumn = float(rhs.nonZeros())/float(cols);
float ratioRes = std::min(ratioLhs * avgNnzPerRhsColumn, 1.f);
res.resize(rows, cols);
// mimics a resizeByInnerOuter:
if(ResultType::IsRowMajor)
res.resize(cols, rows);
else
res.resize(rows, cols);
res.reserve(Index(ratioRes*rows*cols));
for (Index j=0; j<cols; ++j)
{