From 4602b36e9d5ea08656e3222846a1f161bbb1cec1 Mon Sep 17 00:00:00 2001 From: y-jan137 Date: Mon, 27 Apr 2026 07:24:41 +0300 Subject: Module refactor --- experiments/matmul.cpp | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) (limited to 'experiments/matmul.cpp') diff --git a/experiments/matmul.cpp b/experiments/matmul.cpp index ed08c3c..a33b501 100644 --- a/experiments/matmul.cpp +++ b/experiments/matmul.cpp @@ -1,19 +1,7 @@ -#include "linalg_error.hpp" -#include "matrix.hpp" - -#include -#include -#include -#include -#include - -#if !defined(LINEAR_ALGEBRA_FORCE_SCALAR_MATMUL) && defined(__AVX512F__) -# define MATMUL_BACKEND "AVX512" -#elif !defined(LINEAR_ALGEBRA_FORCE_SCALAR_MATMUL) && defined(__AVX2__) -# define MATMUL_BACKEND "AVX2" -#elif !defined(LINEAR_ALGEBRA_FORCE_SCALAR_MATMUL) && defined(__AVX__) -# define MATMUL_BACKEND "AVX" -#elif !defined(LINEAR_ALGEBRA_FORCE_SCALAR_MATMUL) && \ +import linalgebra; +import std; + +#if !defined(LINEAR_ALGEBRA_FORCE_SCALAR_MATMUL) && \ defined(__ARM_NEON) && defined(__aarch64__) && \ defined(__ARM_FEATURE_FP64_VECTOR_ARITHMETIC) # define MATMUL_BACKEND "NEON" @@ -21,14 +9,14 @@ # define MATMUL_BACKEND "scalar" #endif -using linalg::Matrix; +using linalgebra::Matrix; using Clock = std::chrono::high_resolution_clock; using Seconds = std::chrono::duration; Matrix naive_matmul(const Matrix& lhs, const Matrix& rhs) { if (lhs.cols() != rhs.rows()) { - throw linalg::DimensionMismatchError( + throw linalgebra::DimensionMismatchError( "naive_matmul: lhs.cols() != rhs.rows()"); } const std::size_t m = lhs.rows(); @@ -49,8 +37,6 @@ Matrix naive_matmul(const Matrix& lhs, const Matrix& rhs) { return result; } -// --- Helpers --- - Matrix make_matrix(std::size_t n) { Matrix M(n, n); const double inv = 1.0 / static_cast(n + 1); -- cgit v1.2.3