[][src]Function acap::cos::angular_distance

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

Compute the angular distance between two points.

\begin{aligned}
\mathrm{angular\_distance}(x, y) &= \arccos(\mathrm{cosine\_similarity}(x, y)) \\
&= \arccos \left( \frac{x \cdot y}{\|x\| \|y\|} \right) \\
&= \arccos \left( \frac{\sum_i x_i y_i}{\sqrt{\sum_i x_i^2} \sqrt{\sum_i y_i^2}} \right) \\
&= \theta
\end{aligned}