Skip to main content

Module math

Module math 

Source
Expand description

Shared mathematical functions for the Batuta stack.

Provides common math operations (statistics, special functions) used across pmat, trueno, aprender, and trueno-viz.

Functions§

cosine_similarity
Compute cosine similarity between two f64 vectors.
cosine_similarity_f32
Compute cosine similarity between two f32 vectors.
erf
Compute the error function erf(x) using the Abramowitz & Stegun approximation.
erf_f32
Compute erf(x) with f32 precision.
std_dev
Compute sample standard deviation of a slice (Bessel’s correction, n-1).
std_dev_f32
Compute sample standard deviation for f32 data.
std_dev_f32_with_mean
Compute sample standard deviation for f32 data given a pre-computed mean.
std_dev_with_mean
Compute sample standard deviation given a pre-computed mean.
usage_percent
Compute usage percentage from used/total byte counts.