numr 0.15.1

High-performance numerical computing with multi-backend GPU acceleration (CPU/CUDA/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,
}