From ac6b2266b939200dfdcbe415b6ca592293f6d401 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Sun, 25 Oct 2015 22:00:38 +0100 Subject: [PATCH] Fix SparseMatrix::insert/coeffRef for non-empty compressed matrix --- Eigen/src/SparseCore/SparseMatrix.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Eigen/src/SparseCore/SparseMatrix.h b/Eigen/src/SparseCore/SparseMatrix.h index f4d0a28dc..b27061f9e 100644 --- a/Eigen/src/SparseCore/SparseMatrix.h +++ b/Eigen/src/SparseCore/SparseMatrix.h @@ -1132,6 +1132,14 @@ typename SparseMatrix<_Scalar,_Options,_Index>::Scalar& SparseMatrix<_Scalar,_Op for(Index j=1; j<=m_outerSize; ++j) m_outerIndex[j] = end; } + else + { + // turn the matrix into non-compressed mode + m_innerNonZeros = static_cast(std::malloc(m_outerSize * sizeof(StorageIndex))); + if(!m_innerNonZeros) internal::throw_std_bad_alloc(); + for(Index j=0; j