mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-29 07:14:12 +08:00
SparseMatrix::insert add checks for valid indices
This commit is contained in:
parent
c0fe6ce223
commit
59cf0df1d6
@ -563,6 +563,8 @@ class SparseMatrix : public SparseCompressedBase<SparseMatrix<Scalar_, Options_,
|
||||
/** \internal
|
||||
* same as insert(Index,Index) except that the indices are given relative to the storage order */
|
||||
Scalar& insertByOuterInner(Index j, Index i) {
|
||||
eigen_assert(j >= 0 && j < m_outerSize && "invalid outer index");
|
||||
eigen_assert(i >= 0 && i < m_innerSize && "invalid inner index");
|
||||
Index start = m_outerIndex[j];
|
||||
Index end = isCompressed() ? m_outerIndex[j + 1] : start + m_innerNonZeros[j];
|
||||
Index dst = start == end ? end : m_data.searchLowerIndex(start, end, i);
|
||||
|
Loading…
x
Reference in New Issue
Block a user