mlpack  1.0.12
lmetric.hpp
Go to the documentation of this file.
1 
17 #ifndef __MLPACK_CORE_METRICS_LMETRIC_HPP
18 #define __MLPACK_CORE_METRICS_LMETRIC_HPP
19 
20 #include <mlpack/core.hpp>
21 
22 namespace mlpack {
23 namespace metric {
24 
64 template<int Power, bool TakeRoot = true>
65 class LMetric
66 {
67  public:
68  /***
69  * Default constructor does nothing, but is required to satisfy the Kernel
70  * policy.
71  */
72  LMetric() { }
73 
77  template<typename VecType1, typename VecType2>
78  static double Evaluate(const VecType1& a, const VecType2& b);
79  std::string ToString() const;
80 };
81 
82 // Convenience typedefs.
83 
84 /***
85  * The Manhattan (L1) distance.
86  */
88 
89 /***
90  * The squared Euclidean (L2) distance.
91  */
93 
94 /***
95  * The Euclidean (L2) distance.
96  */
98 
99 /***
100  * The L-infinity distance
101  */
103 
104 
105 }; // namespace metric
106 }; // namespace mlpack
107 
108 // Include implementation.
109 #include "lmetric_impl.hpp"
110 
111 #endif
std::string ToString() const
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: load.hpp:23
LMetric< 2, true > EuclideanDistance
Definition: lmetric.hpp:97
LMetric< 2, false > SquaredEuclideanDistance
Definition: lmetric.hpp:92
LMetric< 1, false > ManhattanDistance
Definition: lmetric.hpp:87
static double Evaluate(const VecType1 &a, const VecType2 &b)
Computes the distance between two points.
The L_p metric for arbitrary integer p, with an option to take the root.
Definition: lmetric.hpp:65
LMetric< INT_MAX, false > ChebyshevDistance
Definition: lmetric.hpp:102