backport d97d307fcfc9c9421562705db7bf734865dfd53b

This commit is contained in:
Gael Guennebaud 2009-10-06 10:36:59 +02:00
parent e43d630d80
commit 3b8938ee1a

View File

@ -259,9 +259,11 @@ class SparseMatrix
m_data.resize(k,0); m_data.resize(k,0);
} }
/** Resizes the matrix to a \a rows x \a cols matrix and initializes it to zero
* \sa resizeNonZeros(int), reserve(), setZero()
*/
void resize(int rows, int cols) void resize(int rows, int cols)
{ {
// std::cerr << this << " resize " << rows << "x" << cols << "\n";
const int outerSize = IsRowMajor ? rows : cols; const int outerSize = IsRowMajor ? rows : cols;
m_innerSize = IsRowMajor ? cols : rows; m_innerSize = IsRowMajor ? cols : rows;
m_data.clear(); m_data.clear();
@ -270,8 +272,8 @@ class SparseMatrix
delete[] m_outerIndex; delete[] m_outerIndex;
m_outerIndex = new int [outerSize+1]; m_outerIndex = new int [outerSize+1];
m_outerSize = outerSize; m_outerSize = outerSize;
memset(m_outerIndex, 0, (m_outerSize+1)*sizeof(int));
} }
memset(m_outerIndex, 0, (m_outerSize+1)*sizeof(int));
} }
void resizeNonZeros(int size) void resizeNonZeros(int size)
{ {