9#include "../seq/impl.hpp"
12#ifdef NUMERICS_HAS_BLAS
17void warn_blas_unavailable() {
18#ifndef NUMERICS_HAS_BLAS
19 static bool warned =
false;
24 "[numerics] WARNING: Backend::blas requested but BLAS was not "
27 " Falling back to Backend::blocked (cache-blocked).\n"
28 " Install OpenBLAS and reconfigure: "
29 "apt install libopenblas-dev | brew install openblas\n");
38 warn_blas_unavailable();
39#ifdef NUMERICS_HAS_BLAS
40 cblas_dgemm(CblasRowMajor,
43 static_cast<int>(A.
rows()),
44 static_cast<int>(B.
cols()),
45 static_cast<int>(A.
cols()),
48 static_cast<int>(A.
cols()),
50 static_cast<int>(B.
cols()),
53 static_cast<int>(C.
cols()));
60 warn_blas_unavailable();
61#ifdef NUMERICS_HAS_BLAS
62 cblas_dgemv(CblasRowMajor,
64 static_cast<int>(A.
rows()),
65 static_cast<int>(A.
cols()),
68 static_cast<int>(A.
cols()),
84 warn_blas_unavailable();
85#ifdef NUMERICS_HAS_BLAS
86 cblas_dcopy(
static_cast<int>(A.
size()), A.
data(), 1, C.
data(), 1);
87 cblas_dscal(
static_cast<int>(C.
size()), alpha, C.
data(), 1);
Dense row-major matrix with optional GPU storage.
constexpr idx size() const noexcept
constexpr idx rows() const noexcept
constexpr idx cols() const noexcept
void matmul(const Matrix &A, const Matrix &B, Matrix &C)
void matadd(real alpha, const Matrix &A, real beta, const Matrix &B, Matrix &C)
void matvec(const Matrix &A, const Vector &x, Vector &y)
void matvec(const Matrix &A, const Vector &x, Vector &y)
void matmul_blocked(const Matrix &A, const Matrix &B, Matrix &C, idx block_size)
void matadd(real alpha, const Matrix &A, real beta, const Matrix &B, Matrix &C)
real beta(real a, real b)
B(a, b) – beta function.