19#include "backends/seq/impl.hpp"
21#include "backends/omp/impl.hpp"
119 for (
idx i = 0; i < v.
size(); ++i)
124 for (
idx i = 0; i < x.
size(); ++i)
125 y[i] += alpha * x[i];
130 for (
idx i = 0; i < x.
size(); ++i)
131 sum += std::conj(x[i]) * y[i];
137 for (
idx i = 0; i < x.
size(); ++i)
138 sum += std::norm(x[i]);
139 return std::sqrt(sum);
constexpr idx size() const noexcept
Private declarations for the BLAS backend. Only included by src/core/vector.cpp and src/core/matrix....
Private declarations for the GPU (CUDA) backend. Only included by src/core/vector....
real dot(const Vector &x, const Vector &y)
void axpy(real alpha, const Vector &x, Vector &y)
real norm(const Vector &x)
void scale(Vector &v, real alpha)
void axpy(real alpha, const Vector &x, Vector &y)
real dot(const Vector &x, const Vector &y)
real norm(const Vector &x)
void scale(Vector &v, real alpha)
real dot(const Vector &x, const Vector &y)
void scale(Vector &v, real alpha)
void axpy(real alpha, const Vector &x, Vector &y)
real dot(const Vector &x, const Vector &y)
void scale(Vector &v, real alpha)
real norm(const Vector &x)
void add(const Vector &x, const Vector &y, Vector &z)
void axpy(real alpha, const Vector &x, Vector &y)
void add(const real *x, const real *y, real *z, idx n)
z = x + y
Backend
Selects which backend handles a linalg operation.
@ gpu
CUDA – custom kernels or cuBLAS.
@ omp
OpenMP parallel blocked loops.
@ blocked
Cache-blocked; compiler auto-vectorizes inner loops.
@ simd
Hand-written SIMD intrinsics (AVX2 or NEON)
@ blas
cblas – OpenBLAS, MKL, Apple Accelerate (Level-1/2/3)
@ lapack
LAPACKE – industry-standard factorizations, SVD, eigen.
@ seq
Naive textbook loops – always available.
void scale(Vector &v, real alpha, Backend b=default_backend)
v *= alpha
real dot(const Vector &x, const Vector &y, Backend b=default_backend)
dot product
real norm(const Vector &x, Backend b=default_backend)
Euclidean norm.
std::complex< real > cplx
void axpy(real alpha, const Vector &x, Vector &y, Backend b=default_backend)
y += alpha * x
void add(const Vector &x, const Vector &y, Vector &z, Backend b=default_backend)
z = x + y