float32 #
Compensated (double-double) sums and dot products for f32 inputs, the f32 counterpart of the float64 dd API. Every f32 is exact in f64 and every product of two f32 values is exact in f64 (24 + 24 mantissa bits fit in 53), so accumulating the f64 values with error-free transformations keeps roughly 106 bits of precision: the results stay accurate on inputs where naive f32 evaluation cancels catastrophically, and the compensated variants are correctly rounded in practice (see vlang/vsl#65).
fn acos #
fn acos(x f32) f32
acos returns arccos(x).
fn arrays_tolerance #
fn arrays_tolerance(data1 []f32, data2 []f32, tol f32) bool
arrays_tolerance exposes this operation as part of the public API.
fn asin #
fn asin(x f32) f32
asin returns arcsin(x).
fn atan #
fn atan(x f32) f32
atan returns arctan(x).
fn axpy_inc #
fn axpy_inc(alpha f32, x []f32, mut y []f32, n u32, incX u32, incY u32, ix u32, iy u32)
axpy_inc
fn axpy_inc_to #
fn axpy_inc_to(mut dst []f32, incdst u32, idst u32, alpha f32, x []f32, y []f32, n u32, incX u32, incY u32, ix u32, iy u32)
axpy_inc_to
fn axpy_unitary #
fn axpy_unitary(alpha f32, x []f32, mut y []f32)
axpy_unitary Length validation allows direct indexed access in the hot loop.
fn axpy_unitary_to #
fn axpy_unitary_to(mut dst []f32, alpha f32, x []f32, y []f32)
axpy_unitary_to Length validation allows direct indexed access in the hot loop.
fn cos #
fn cos(x f32) f32
cos returns cos(x).
fn cosh #
fn cosh(x f32) f32
cosh returns cosh(x).
fn dot_compensated #
fn dot_compensated(x []f32, y []f32) f32
dot_compensated returns the dot product of x and y rounded once to f32 from the double-double result: correctly rounded in practice.
fn dot_dd #
fn dot_dd(x []f32, y []f32) (f64, f64)
dot_dd returns the double-double dot product (hi, lo) of x and y. Each product is exact in f64, so no product splitting is needed before the compensated accumulation.
fn dot_inc #
fn dot_inc(x []f32, y []f32, n u32, incX u32, incY u32, ix u32, iy u32) f32
dot_inc
fn dot_unitary #
fn dot_unitary(x []f32, y []f32) f32
dot_unitary returns the f32 dot product, accumulating rounded f32 products in f64 so low-order terms are retained until the final f32 result. Length validation allows direct indexed access in the hot loop.
fn exp #
fn exp(x f32) f32
exp returns e^x, correctly rounded in practice (see module comment).
fn exp2 #
fn exp2(x f32) f32
exp2 returns 2^x.
fn expm1 #
fn expm1(x f32) f32
expm1 returns e^x - 1, accurate for x near zero.
fn gemv_n #
fn gemv_n(m u32, n u32, alpha f32, a []f32, lda u32, x []f32, incx int, beta f32, mut y []f32, incy int)
gemv_n computes y = alpha * A * x + beta * y where A is an m×n dense matrix, x and y are vectors, and alpha and beta are scalars.
fn gemv_t #
fn gemv_t(m u32, n u32, alpha f32, a []f32, lda u32, x []f32, incx int, beta f32, mut y []f32, incy int)
gemv_t computes y = alpha * Aᵀ * x + beta * y where A is an m×n dense matrix, x and y are vectors, and alpha and beta are scalars.
fn ger #
fn ger(m u32, n u32, alpha f32, x []f32, incx u32, y []f32, incy u32, mut a []f32, lda u32)
ger performs the rank-one operation A += alpha * x * yᵀ where A is an m×n dense matrix, x and y are vectors, and alpha is a scalar.
fn l2_distance_unitary #
fn l2_distance_unitary(x []f32, y []f32) f32
l2_distance_unitary returns the L2-norm of x-y.
fn l2_norm_inc #
fn l2_norm_inc(x []f32, n u32, incx u32) f32
l2_norm_inc returns the L2-norm of x.
fn l2_norm_unitary #
fn l2_norm_unitary(x []f32) f32
l2_norm_unitary returns the L2-norm of x.
fn log #
fn log(x f32) f32
log returns the natural logarithm of x.
fn log10 #
fn log10(x f32) f32
log10 returns the base-10 logarithm of x.
fn log1p #
fn log1p(x f32) f32
log1p returns log(1 + x), accurate for x near zero.
fn log2 #
fn log2(x f32) f32
log2 returns the base-2 logarithm of x.
fn scal_inc #
fn scal_inc(alpha f32, mut x []f32, n u32, incx u32)
scal_inc
fn scal_inc_to #
fn scal_inc_to(mut dst []f32, incdst u32, alpha f32, x []f32, n u32, incx u32)
scal_inc_to
fn scal_unitary #
fn scal_unitary(alpha f32, mut x []f32)
scal_unitary
fn scal_unitary_to #
fn scal_unitary_to(mut dst []f32, alpha f32, x []f32)
scal_unitary_to
fn sin #
fn sin(x f32) f32
sin returns sin(x). Accuracy for very large |x| is bounded by the libm argument reduction beyond 1e15, as in float64.
fn sinh #
fn sinh(x f32) f32
sinh returns sinh(x).
fn sum_compensated #
fn sum_compensated(x []f32) f32
sum_compensated returns the sum of x rounded once to f32 from the double-double sum: correctly rounded in practice.
fn sum_dd #
fn sum_dd(x []f32) (f64, f64)
sum_dd returns the double-double sum (hi, lo) of x: hi + lo approximates the true sum with roughly 106 bits of precision.
fn tan #
fn tan(x f32) f32
tan returns tan(x).
fn tanh #
fn tanh(x f32) f32
tanh returns tanh(x).
- README
- fn acos
- fn arrays_tolerance
- fn asin
- fn atan
- fn axpy_inc
- fn axpy_inc_to
- fn axpy_unitary
- fn axpy_unitary_to
- fn cos
- fn cosh
- fn dot_compensated
- fn dot_dd
- fn dot_inc
- fn dot_unitary
- fn exp
- fn exp2
- fn expm1
- fn gemv_n
- fn gemv_t
- fn ger
- fn l2_distance_unitary
- fn l2_norm_inc
- fn l2_norm_unitary
- fn log
- fn log10
- fn log1p
- fn log2
- fn scal_inc
- fn scal_inc_to
- fn scal_unitary
- fn scal_unitary_to
- fn sin
- fn sinh
- fn sum_compensated
- fn sum_dd
- fn tan
- fn tanh