From 78754684f457606f252d2f1c844a261632e13031 Mon Sep 17 00:00:00 2001 From: Joana Niermann Date: Wed, 18 Dec 2024 17:27:47 +0100 Subject: [PATCH] Explicitly initialize every element in array matrix --- math/cmath/include/algebra/math/impl/cmath_matrix.hpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/math/cmath/include/algebra/math/impl/cmath_matrix.hpp b/math/cmath/include/algebra/math/impl/cmath_matrix.hpp index 796569be..585fd01c 100644 --- a/math/cmath/include/algebra/math/impl/cmath_matrix.hpp +++ b/math/cmath/include/algebra/math/impl/cmath_matrix.hpp @@ -19,7 +19,15 @@ namespace algebra::cmath { template requires(std::is_scalar_v) ALGEBRA_HOST_DEVICE inline matrix_t zero() { - return matrix_t{}; + matrix_t ret; + + for (std::size_t j = 0; j < algebra::traits::columns; ++j) { + for (std::size_t i = 0; i < algebra::traits::rows; ++i) { + ret[j][i] = 0; + } + } + + return ret; } /// @returns identity matrix of type @tparam matrix_t