From 5c39e7685d006fc33d9f439e3a4241519b9f8c2c Mon Sep 17 00:00:00 2001 From: Dmitri Naumov <github@naumov.de> Date: Sun, 6 Jan 2019 18:17:27 +0100 Subject: [PATCH] [MaL] Avoid implicit conversion IndexType to int. Conversion happened in the constant vectorXi construction. --- MathLib/LinAlg/Eigen/EigenMatrix.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/MathLib/LinAlg/Eigen/EigenMatrix.h b/MathLib/LinAlg/Eigen/EigenMatrix.h index f06b290a8de..e6caa38977b 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 -- GitLab