bug #1574: implement "sparse_matrix =,+=,-= diagonal_matrix" with smart insertion strategies of missing diagonal coeffs.

This commit is contained in:
Gael Guennebaud
2019-01-28 17:29:50 +01:00
parent 803fa79767
commit f489f44519
4 changed files with 156 additions and 24 deletions

View File

@@ -207,6 +207,22 @@ class CompressedStorage
return m_values[id];
}
void moveChunk(Index from, Index to, Index chunkSize)
{
eigen_internal_assert(to+chunkSize <= m_size);
if(to>from && from+chunkSize>to)
{
// move backward
internal::smart_memmove(m_values+from, m_values+from+chunkSize, m_values+to);
internal::smart_memmove(m_indices+from, m_indices+from+chunkSize, m_indices+to);
}
else
{
internal::smart_copy(m_values+from, m_values+from+chunkSize, m_values+to);
internal::smart_copy(m_indices+from, m_indices+from+chunkSize, m_indices+to);
}
}
void prune(const Scalar& reference, const RealScalar& epsilon = NumTraits<RealScalar>::dummy_precision())
{
Index k = 0;