void to_device(real *dst, const real *src, idx n)
Copy host to device.
void scale(real *v, idx n, real alpha)
v = alpha * v
void thomas_batched(const real *a, const real *b, const real *c, const real *d, real *x, idx n, idx batch_size)
Batched Thomas algorithm for tridiagonal systems.
void matmul(const real *A, const real *B, real *C, idx m, idx k, idx n)
C = A * B.
void free(real *ptr)
Free device memory.
real * alloc(idx n)
Allocate device memory.
void to_host(real *dst, const real *src, idx n)
Copy device to host.
void add(const real *x, const real *y, real *z, idx n)
z = x + y
void axpy(real alpha, const real *x, real *y, idx n)
y = alpha*x + y
real dot(const real *x, const real *y, idx n)
dot product
void matvec(const real *A, const real *x, real *y, idx rows, idx cols)
y = A * x (row-major A)
constexpr T ipow(T x) noexcept
Compute x^N at compile time via repeated squaring.