add a smart realloc algorithm when filling a sparse matrix

This commit is contained in:
Gael Guennebaud
2009-01-18 18:00:19 +00:00
parent 0c7974dd4d
commit d58bb54e7f
3 changed files with 20 additions and 8 deletions

View File

@@ -82,7 +82,7 @@ class CompressedStorage
reallocate(m_size);
}
void resize(int size, int reserveSizeFactor = 0)
void resize(int size, float reserveSizeFactor = 0)
{
if (m_allocatedSize<size)
reallocate(size + reserveSizeFactor*size);
@@ -98,6 +98,7 @@ class CompressedStorage
}
int size() const { return m_size; }
int allocatedSize() const { return m_allocatedSize; }
void clear() { m_size = 0; }
Scalar& value(int i) { return m_values[i]; }