diff options
author | 2011-03-08 16:37:59 +0100 | |
---|---|---|
committer | 2011-03-08 16:37:59 +0100 | |
commit | 5d1263e7c546ad6dcf6490fed8e6b57355b77a2d (patch) | |
tree | 4132c1fb2e85df20476b2bc506591a2e7fa01028 /Eigen | |
parent | c6c6c3490949fcdf68c7fd347a91728d7c5f6c96 (diff) |
bug #37: fix resizing when the destination sparse matrix is row major
Diffstat (limited to 'Eigen')
-rw-r--r-- | Eigen/src/Sparse/SparseSparseProduct.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Eigen/src/Sparse/SparseSparseProduct.h b/Eigen/src/Sparse/SparseSparseProduct.h index b7ed151b4..cade6fd54 100644 --- a/Eigen/src/Sparse/SparseSparseProduct.h +++ b/Eigen/src/Sparse/SparseSparseProduct.h @@ -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) { |