pub fn cosine<T>(point1: &[T], point2: &[T]) -> Twhere
T: Float,Expand description
Compute Cosine distance between two points
§Arguments
point1- First pointpoint2- Second point
§Returns
- Cosine distance between the points (1 - cosine similarity)
§Examples
use scirs2_spatial::distance::cosine;
let point1 = &[1.0, 0.0];
let point2 = &[0.0, 1.0];
let dist = cosine(point1, point2);
assert!((dist - 1.0f64).abs() < 1e-6);