bug #1258: fix compilation of Map<SparseMatrix>::coeffRef

This commit is contained in:
Gael Guennebaud
2016-07-26 09:40:19 +02:00
parent c9425492c8
commit 757971e7ea
2 changed files with 12 additions and 1 deletions

View File

@@ -186,7 +186,7 @@ class SparseMapBase<Derived,WriteAccessors>
Index end = Base::isCompressed() ? Base::m_outerIndex[outer+1] : start + Base::m_innerNonZeros[outer];
eigen_assert(end>=start && "you probably called coeffRef on a non finalized matrix");
eigen_assert(end>start && "coeffRef cannot be called on a zero coefficient");
Index* r = std::lower_bound(&Base::m_innerIndices[start],&Base::m_innerIndices[end],inner);
StorageIndex* r = std::lower_bound(&Base::m_innerIndices[start],&Base::m_innerIndices[end],inner);
const Index id = r - &Base::m_innerIndices[0];
eigen_assert((*r==inner) && (id<end) && "coeffRef cannot be called on a zero coefficient");
return const_cast<Scalar*>(Base::m_values)[id];