From 42f05581a3b877db8dfc6c5ea92660c2398f2eac Mon Sep 17 00:00:00 2001 From: Christoph Lehmann <christoph.lehmann@ufz.de> Date: Wed, 11 Nov 2015 18:19:30 +0100 Subject: [PATCH] [MaL] EigenMatrix adapted to new sparsity pattern --- MathLib/LinAlg/Eigen/EigenMatrix.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/MathLib/LinAlg/Eigen/EigenMatrix.h b/MathLib/LinAlg/Eigen/EigenMatrix.h index 44e15aff2d1..24396601ebc 100644 --- a/MathLib/LinAlg/Eigen/EigenMatrix.h +++ b/MathLib/LinAlg/Eigen/EigenMatrix.h @@ -197,13 +197,10 @@ void operator()(EigenMatrix &matrix, SPARSITY_PATTERN const& sparsity_pattern) static_assert(EigenMatrix::RawMatrixType::IsRowMajor, "Set matrix sparsity relies on the EigenMatrix to be in " "row-major storage order."); - auto const n_rows = matrix.getNRows(); - Eigen::VectorXi row_sizes(n_rows); - for (auto i = decltype(n_rows){0}; i < n_rows; i++) - row_sizes[i] = sparsity_pattern.getNodeDegree(i); + assert(matrix.getNRows() == sparsity_pattern.size()); - matrix.getRawMatrix().reserve(row_sizes); + matrix.getRawMatrix().reserve(sparsity_pattern); } }; -- GitLab