numr 1.0.0

Numerical computing and tensor library for Rust, in the role of NumPy: n-dimensional arrays, linear algebra, FFT, statistics and autograd on CPU, CUDA and WebGPU
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Result type of the one-pass cosine reduction.

/// The three sums cosine distance needs, gathered in one pass.
///
/// The caller turns them into a distance. `metrics::cosine_from_sums` owns that
/// formula, including its `denom == 0 -> 0` rule.
#[derive(Copy, Clone, Debug, PartialEq)]
pub struct CosineSums<T> {
    /// `sum(a[i] * b[i])`.
    pub dot: T,
    /// `sum(a[i] * a[i])`.
    pub norm_a: T,
    /// `sum(b[i] * b[i])`.
    pub norm_b: T,
}