Skip to main content

distance

Function distance 

Source
pub fn distance(metric: Metric, a: &[f32], b: &[f32]) -> Result<f32>
Expand description

Dispatch a distance computation by slate_core::Metric.

Convenience for callers that hold a runtime Metric. Cosine here uses the raw-input path (cosine); when the storage layer pre-normalizes vectors, prefer calling cosine_normalized (or inner_product) directly to skip the redundant norm computation.

ยงErrors

Returns Error::DimensionMismatch if a.len() != b.len().