diff options
| author | y-jan137 <yousefjan24000@gmail.com> | 2026-04-27 07:24:41 +0300 |
|---|---|---|
| committer | y-jan137 <yousefjan24000@gmail.com> | 2026-04-27 07:24:41 +0300 |
| commit | 4602b36e9d5ea08656e3222846a1f161bbb1cec1 (patch) | |
| tree | 87618f154f7ebe91657ba1501d695d45a31e7881 /experiments/matmul.cpp | |
| parent | b8bc28c70a6f2b0e7de81e85a796303d514df008 (diff) | |
Module refactor
Diffstat (limited to 'experiments/matmul.cpp')
| -rw-r--r-- | experiments/matmul.cpp | 24 |
1 files changed, 5 insertions, 19 deletions
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" +import linalgebra; +import std; -#include <chrono> -#include <cstddef> -#include <iomanip> -#include <iostream> -#include <vector> - -#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) && \ +#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<double>; 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<double>(n + 1); |