mlpack
cosine_distance.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_CORE_KERNELS_COSINE_DISTANCE_HPP
14 #define MLPACK_CORE_KERNELS_COSINE_DISTANCE_HPP
15 
16 #include <mlpack/prereqs.hpp>
18 
19 namespace mlpack {
20 namespace kernel {
21 
32 {
33  public:
41  template<typename VecTypeA, typename VecTypeB>
42  static double Evaluate(const VecTypeA& a, const VecTypeB& b);
43 
45  template<typename Archive>
46  void serialize(Archive& /* ar */, const uint32_t /* version */) { }
47 };
48 
50 template<>
52 {
53  public:
55  static const bool IsNormalized = true;
56 
58  static const bool UsesSquaredDistance = false;
59 };
60 
61 } // namespace kernel
62 } // namespace mlpack
63 
64 // Include implementation.
65 #include "cosine_distance_impl.hpp"
66 
67 #endif
This is a template class that can provide information about various kernels.
Definition: kernel_traits.hpp:27
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
The cosine distance (or cosine similarity).
Definition: cosine_distance.hpp:31
void serialize(Archive &, const uint32_t)
Serialize the class (there&#39;s nothing to save).
Definition: cosine_distance.hpp:46
The core includes that mlpack expects; standard C++ includes and Armadillo.
static double Evaluate(const VecTypeA &a, const VecTypeB &b)
Computes the cosine distance between two points.
Definition: cosine_distance_impl.hpp:21