From c65743e9571d38192d0c059b02eed9541477e04b Mon Sep 17 00:00:00 2001 From: CHatingPython Date: Sun, 1 Nov 2026 13:20:19 +0100 Subject: [PATCH] fix(math): fix transpose operation --- include/cenet/math/ops.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/cenet/math/ops.hpp b/include/cenet/math/ops.hpp index 199ac3e..a61e9a0 100644 --- a/include/cenet/math/ops.hpp +++ b/include/cenet/math/ops.hpp @@ -195,8 +195,9 @@ struct transpose { template constexpr auto operator()(std::size_t index, const E& expr) const { + const std::size_t rows = expr.shape().template get<0>(); const std::size_t cols = expr.shape().template get<1>(); - return expr.coeff(((index % cols) * cols) + (index / cols)); + return expr.coeff(((index % rows) * cols) + (index / rows)); } };