mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-21 07:19:46 +08:00
SparseMatrix::insert: switch to a fully uncompressed mode if sequential insertion is not possible (otherwise an arbitrary large amount of memory was preallocated in some cases)
This commit is contained in:
parent
5ffe29cb9f
commit
a9df28c95b
@ -1172,8 +1172,12 @@ typename SparseMatrix<_Scalar,_Options,_Index>::Scalar& SparseMatrix<_Scalar,_Op
|
||||
return (m_data.value(p) = 0);
|
||||
}
|
||||
|
||||
// make sure the matrix is compatible to random un-compressed insertion:
|
||||
m_data.resize(m_data.allocatedSize());
|
||||
if(m_data.size() != m_data.allocatedSize())
|
||||
{
|
||||
// make sure the matrix is compatible to random un-compressed insertion:
|
||||
m_data.resize(m_data.allocatedSize());
|
||||
this->reserveInnerVectors(Array<StorageIndex,Dynamic,1>::Constant(2*m_outerSize, convert_index(m_outerSize)));
|
||||
}
|
||||
|
||||
return insertUncompressed(row,col);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user