[][src]Function acap::cos::prenorm_cosine_distance

pub fn prenorm_cosine_distance<T, U>(x: T, y: U) -> T::Value where
    T: Coordinates,
    U: Coordinates<Value = T::Value>,
    T::Value: Real

Compute the cosine distance between two pre-normalized (unit magnitude) points.

\begin{aligned}
\mathrm{prenorm\_cosine\_distance}(x, y) &= 1 - \mathrm{prenorm\_cosine\_similarity}(x, y) \\
&= 1 - x \cdot y \\
&= 1 - \sum_i x_i y_i \\
&= 1 - \cos \theta
\end{aligned}