diff --git a/include/omath/linear_algebra/mat.hpp b/include/omath/linear_algebra/mat.hpp index fce2acb..f0f8bb4 100644 --- a/include/omath/linear_algebra/mat.hpp +++ b/include/omath/linear_algebra/mat.hpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #ifdef OMATH_USE_AVX2 @@ -149,7 +150,8 @@ namespace omath } } - [[nodiscard("You must use element reference")]] constexpr Type& at(const size_t row_index, const size_t column_index) + [[nodiscard("You must use element reference")]] constexpr Type& at(const size_t row_index, + const size_t column_index) { return const_cast(std::as_const(*this).at(row_index, column_index)); } @@ -176,6 +178,13 @@ namespace omath operator*(const Mat& other) const { #ifdef OMATH_USE_AVX2 + if (std::is_constant_evaluated()) + { + if constexpr (StoreType == MatStoreType::ROW_MAJOR) + return cache_friendly_multiply_row_major(other); + else if constexpr (StoreType == MatStoreType::COLUMN_MAJOR) + return cache_friendly_multiply_col_major(other); + } if constexpr (StoreType == MatStoreType::ROW_MAJOR) return avx_multiply_row_major(other); else if constexpr (StoreType == MatStoreType::COLUMN_MAJOR)