aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2009-06-08 14:12:11 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2009-06-08 14:12:11 +0200
commitd97d307fcfc9c9421562705db7bf734865dfd53b (patch)
treecce4b917fe991674eae285eea641f5a9398c17dc /Eigen
parent55de162cf6fa3e666ef6b07223c18ae9cd1f1a30 (diff)
SparseMatrix::resize() always resets the matrix to an empty one
Diffstat (limited to 'Eigen')
-rw-r--r--Eigen/src/Sparse/SparseMatrix.h6
-rw-r--r--Eigen/src/Sparse/SparseProduct.h1
2 files changed, 4 insertions, 3 deletions
diff --git a/Eigen/src/Sparse/SparseMatrix.h b/Eigen/src/Sparse/SparseMatrix.h
index 8c665e35b..03bc60bb5 100644
--- a/Eigen/src/Sparse/SparseMatrix.h
+++ b/Eigen/src/Sparse/SparseMatrix.h
@@ -363,9 +363,11 @@ class SparseMatrix
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)
{
-// std::cerr << this << " resize " << rows << "x" << cols << "\n";
const int outerSize = IsRowMajor ? rows : cols;
m_innerSize = IsRowMajor ? cols : rows;
m_data.clear();
@@ -374,8 +376,8 @@ class SparseMatrix
delete[] m_outerIndex;
m_outerIndex = new int [outerSize+1];
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)
{
diff --git a/Eigen/src/Sparse/SparseProduct.h b/Eigen/src/Sparse/SparseProduct.h
index 91b4f1218..5222439d8 100644
--- a/Eigen/src/Sparse/SparseProduct.h
+++ b/Eigen/src/Sparse/SparseProduct.h
@@ -192,7 +192,6 @@ static void ei_sparse_product_impl(const Lhs& lhs, const Rhs& rhs, ResultType& r
float ratioRes = std::min(ratioLhs * avgNnzPerRhsColumn, 1.f);
res.resize(rows, cols);
- res.setZero();
res.reserve(int(ratioRes*rows*cols));
for (int j=0; j<cols; ++j)
{