Fix serialization for non-compressed matrices.

This commit is contained in:
Antonio Sánchez
2022-11-30 18:16:47 +00:00
parent 2260e11eb0
commit dcb042a87d
2 changed files with 39 additions and 28 deletions

View File

@@ -30,7 +30,7 @@ struct RandomImpl<Eigen::SparseMatrix<Scalar, Options, DenseIndex>> {
double density = 0.1;
// Reserve some space along each inner dim.
int nnz = static_cast<int>(density * 1.5 * M.innerSize());
int nnz = static_cast<int>(std::ceil(density * 1.5 * M.innerSize()));
M.reserve(Eigen::VectorXi::Constant(M.outerSize(), nnz));
for (int j = 0; j < M.outerSize(); j++) {