RandomSetter: turns the matrix into compressed form before the filling

This commit is contained in:
Gael Guennebaud 2011-12-03 17:35:21 +01:00
parent c0e36516f3
commit 950eeab4d7

View File

@ -227,6 +227,7 @@ class RandomSetter
if (!SwapStorage) // also means the map is sorted if (!SwapStorage) // also means the map is sorted
{ {
mp_target->setZero(); mp_target->setZero();
mp_target->makeCompressed();
mp_target->reserve(nonZeros()); mp_target->reserve(nonZeros());
Index prevOuter = -1; Index prevOuter = -1;
for (Index k=0; k<m_outerPackets; ++k) for (Index k=0; k<m_outerPackets; ++k)
@ -271,6 +272,7 @@ class RandomSetter
positions[j] = count; positions[j] = count;
count += tmp; count += tmp;
} }
mp_target->makeCompressed();
mp_target->_outerIndexPtr()[mp_target->outerSize()] = count; mp_target->_outerIndexPtr()[mp_target->outerSize()] = count;
mp_target->resizeNonZeros(count); mp_target->resizeNonZeros(count);
// pass 2 // pass 2