diff --git a/MathLib/LinAlg/Eigen/EigenMatrix.h b/MathLib/LinAlg/Eigen/EigenMatrix.h
index f06b290a8de071e497d3785c2ff32d3f349b2c04..e6caa38977bee7f0b6649ed38ed804d7dd7ffb76 100644
--- a/MathLib/LinAlg/Eigen/EigenMatrix.h
+++ b/MathLib/LinAlg/Eigen/EigenMatrix.h
@@ -39,10 +39,14 @@ public:
      * @param n the number of rows (that is equal to the number of columns)
      * @param n_nonzero_columns the number of non-zero columns used for preallocation
      */
-    explicit EigenMatrix(IndexType n, IndexType n_nonzero_columns = 0) :_mat(n, n)
+    explicit EigenMatrix(IndexType n, IndexType n_nonzero_columns = 0)
+        : _mat(n, n)
     {
         if (n_nonzero_columns > 0)
-            _mat.reserve(Eigen::VectorXi::Constant(n, n_nonzero_columns));
+        {
+            _mat.reserve(Eigen::Matrix<IndexType, Eigen::Dynamic, 1>::Constant(
+                n, n_nonzero_columns));
+        }
     }
 
     /// return the number of rows