aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/SparseCore/SparseMatrix.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2015-10-25 22:00:38 +0100
committerGravatar Gael Guennebaud <g.gael@free.fr>2015-10-25 22:00:38 +0100
commitac6b2266b939200dfdcbe415b6ca592293f6d401 (patch)
tree8ea03b1c202eba4ac53a866cb43079207a8116ce /Eigen/src/SparseCore/SparseMatrix.h
parent85afb614177b4721235fafa139a77f9888a090ec (diff)
Fix SparseMatrix::insert/coeffRef for non-empty compressed matrix
Diffstat (limited to 'Eigen/src/SparseCore/SparseMatrix.h')
-rw-r--r--Eigen/src/SparseCore/SparseMatrix.h8
1 files changed, 8 insertions, 0 deletions
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<StorageIndex*>(std::malloc(m_outerSize * sizeof(StorageIndex)));
+ if(!m_innerNonZeros) internal::throw_std_bad_alloc();
+ for(Index j=0; j<m_outerSize; ++j)
+ m_innerNonZeros[j] = m_outerIndex[j+1]-m_outerIndex[j];
+ }
}
// check whether we can do a fast "push back" insertion