|
numerics 0.1.0
|
Functions | |
| NUM_K_AINLINE void | scale (real *NUM_K_RESTRICT x, real alpha, idx n) noexcept |
| x[i] *= alpha | |
| NUM_K_AINLINE void | axpy (real *NUM_K_RESTRICT y, const real *NUM_K_RESTRICT x, real alpha, idx n) noexcept |
| y[i] += alpha * x[i] | |
| NUM_K_AINLINE void | axpby (real *NUM_K_RESTRICT y, const real *NUM_K_RESTRICT x, real a, real b, idx n) noexcept |
| y[i] = a*x[i] + b*y[i] (fused scale-and-add, one memory pass) | |
| NUM_K_AINLINE void | axpbyz (real *NUM_K_RESTRICT z, const real *NUM_K_RESTRICT x, const real *NUM_K_RESTRICT y, real a, real b, idx n) noexcept |
| z[i] = a*x[i] + b*y[i] (fused, three-array, one pass each) | |
| NUM_K_AINLINE real | dot (const real *NUM_K_RESTRICT x, const real *NUM_K_RESTRICT y, idx n) noexcept |
| dot product: return sum x[i] * y[i] | |
| NUM_K_AINLINE real | norm_sq (const real *NUM_K_RESTRICT x, idx n) noexcept |
| sum x[i]^2 (no sqrt; use for convergence checks to avoid sqrt cost) | |
| NUM_K_AINLINE real | norm (const real *NUM_K_RESTRICT x, idx n) noexcept |
| Euclidean norm: sqrt(sum x[i]^2) | |
| NUM_K_AINLINE real | l1_norm (const real *NUM_K_RESTRICT x, idx n) noexcept |
| L1 norm: sum |x[i]|. | |
| NUM_K_AINLINE real | linf_norm (const real *NUM_K_RESTRICT x, idx n) noexcept |
| L-infinity norm: max |x[i]|. | |
| NUM_K_AINLINE real | sum (const real *NUM_K_RESTRICT x, idx n) noexcept |
| Scalar sum: return sum x[i]. | |
| NUM_K_AINLINE void | matvec (real *NUM_K_RESTRICT y, const real *NUM_K_RESTRICT A, const real *NUM_K_RESTRICT x, idx m, idx n) noexcept |
| y[i] = sum_j A[i*n + j] * x[j] (m x n row-major matrix) | |
| NUM_K_AINLINE void | ger (real *NUM_K_RESTRICT A, const real *NUM_K_RESTRICT x, const real *NUM_K_RESTRICT y, real alpha, idx m, idx n) noexcept |
| Rank-1 update: A[i*n + j] += alpha * x[i] * y[j] (m x n row-major) | |
| NUM_K_AINLINE void | trsv_lower (real *NUM_K_RESTRICT x, const real *NUM_K_RESTRICT L, const real *NUM_K_RESTRICT b, idx n) noexcept |
| Forward substitution: solve Lx = b, L lower triangular (n x n, row-major). | |
| NUM_K_AINLINE void | trsv_upper (real *NUM_K_RESTRICT x, const real *NUM_K_RESTRICT U, const real *NUM_K_RESTRICT b, idx n) noexcept |
| Back substitution: solve Ux = b, U upper triangular (n x n, row-major). | |
|
noexcept |
y[i] = a*x[i] + b*y[i] (fused scale-and-add, one memory pass)
No direct BLAS equivalent. Avoids a separate scale pass then axpy pass: compared to scale(y,b); axpy(a,x,y), this reads y only once.
Definition at line 113 of file raw.hpp.
References NUM_K_IVDEP.
Referenced by num::kernel::array::axpby().
|
noexcept |
z[i] = a*x[i] + b*y[i] (fused, three-array, one pass each)
No direct BLAS equivalent. z may alias x or y; otherwise fully independent.
Definition at line 125 of file raw.hpp.
References NUM_K_IVDEP.
Referenced by num::kernel::array::axpbyz().
|
noexcept |
|
noexcept |
|
noexcept |
Rank-1 update: A[i*n + j] += alpha * x[i] * y[j] (m x n row-major)
BLAS dger equivalent. Inner loop over j is independent and vectorizable.
Definition at line 254 of file raw.hpp.
References NUM_K_IVDEP, and NUM_K_RESTRICT.
Referenced by num::kernel::dense::ger().
|
noexcept |
L1 norm: sum |x[i]|.
Definition at line 174 of file raw.hpp.
References NUM_K_IVDEP.
Referenced by num::kernel::reduce::l1_norm().
|
noexcept |
L-infinity norm: max |x[i]|.
Definition at line 189 of file raw.hpp.
Referenced by num::kernel::reduce::linf_norm().
|
noexcept |
y[i] = sum_j A[i*n + j] * x[j] (m x n row-major matrix)
y must be pre-allocated with size m. y and x must not alias A.
Definition at line 227 of file raw.hpp.
References NUM_K_IVDEP.
|
noexcept |
|
noexcept |
sum x[i]^2 (no sqrt; use for convergence checks to avoid sqrt cost)
Definition at line 153 of file raw.hpp.
References NUM_K_IVDEP.
Referenced by norm().
|
noexcept |
|
noexcept |
Scalar sum: return sum x[i].
No BLAS equivalent (cblas_dasum sums absolute values; this does not).
Definition at line 210 of file raw.hpp.
References NUM_K_IVDEP.
Referenced by num::kernel::reduce::sum().
|
noexcept |
Forward substitution: solve Lx = b, L lower triangular (n x n, row-major).
x must be pre-allocated with size n. b and x must not alias each other. Uses BLAS dtrsv when available (copies b -> x first, then solves in-place).
Definition at line 280 of file raw.hpp.
Referenced by num::kernel::dense::trsv_lower().
|
noexcept |
Back substitution: solve Ux = b, U upper triangular (n x n, row-major).
x must be pre-allocated with size n. b and x must not alias each other. Uses BLAS dtrsv when available (copies b -> x first, then solves in-place).
Definition at line 305 of file raw.hpp.
Referenced by num::kernel::dense::trsv_upper().