12 #ifndef MLPACK_CORE_KERNELS_COSINE_DISTANCE_IMPL_HPP 13 #define MLPACK_CORE_KERNELS_COSINE_DISTANCE_IMPL_HPP 20 template<
typename VecTypeA,
typename VecTypeB>
28 const double denominator = norm(a, 2) * norm(b, 2);
29 if (denominator == 0.0)
32 return dot(a, b) / denominator;
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
static double Evaluate(const VecTypeA &a, const VecTypeB &b)
Computes the cosine distance between two points.
Definition: cosine_distance_impl.hpp:21