mlpack  2.0.1
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 TPower, bool TTakeRoot = true>
65 class LMetric
66 {
67  public:
68  /***
69  * Default constructor does nothing, but is required to satisfy the Metric
70  * policy.
71  */
72  LMetric() { }
73 
84  template<typename VecTypeA, typename VecTypeB>
85  static double Evaluate(const VecTypeA& a, const VecTypeB& b);
86 
88  template<typename Archive>
89  void Serialize(Archive& /* ar */, const unsigned int /* version */) { }
90 
92  static const int Power = TPower;
94  static const bool TakeRoot = TTakeRoot;
95 };
96 
97 // Convenience typedefs.
98 
103 
109 
114 
119 
120 
121 } // namespace metric
122 } // namespace mlpack
123 
124 // Include implementation.
125 #include "lmetric_impl.hpp"
126 
127 #endif
Linear algebra utility functions, generally performed on matrices or vectors.
LMetric< 2, true > EuclideanDistance
The Euclidean (L2) distance.
Definition: lmetric.hpp:113
LMetric< 2, false > SquaredEuclideanDistance
The squared Euclidean (L2) distance.
Definition: lmetric.hpp:108
void Serialize(Archive &, const unsigned int)
Serialize the metric (nothing to do).
Definition: lmetric.hpp:89
LMetric< 1, false > ManhattanDistance
The Manhattan (L1) distance.
Definition: lmetric.hpp:102
Include all of the base components required to write MLPACK methods, and the main MLPACK Doxygen docu...
The L_p metric for arbitrary integer p, with an option to take the root.
Definition: lmetric.hpp:65
static const int Power
The power of the metric.
Definition: lmetric.hpp:92
LMetric< INT_MAX, false > ChebyshevDistance
The L-infinity distance.
Definition: lmetric.hpp:118
static double Evaluate(const VecTypeA &a, const VecTypeB &b)
Computes the distance between two points.
static const bool TakeRoot
Whether or not the root is taken.
Definition: lmetric.hpp:94