Fix #1974: assertion when reserving an empty sparse matrix
diff --git a/test/sparse_basic.cpp b/test/sparse_basic.cpp
index 9e735b3..5f87621 100644
--- a/test/sparse_basic.cpp
+++ b/test/sparse_basic.cpp
@@ -662,6 +662,14 @@
iters[0] = IteratorType(m2,0);
iters[1] = IteratorType(m2,m2.outerSize()-1);
}
+
+ // test reserve with empty rows/columns
+ {
+ SparseMatrixType m1(0,cols);
+ m1.reserve(ArrayXi::Constant(m1.outerSize(),1));
+ SparseMatrixType m2(rows,0);
+ m2.reserve(ArrayXi::Constant(m2.outerSize(),1));
+ }
}