lmetric.hpp

Go to the documentation of this file.
00001 
00025 #ifndef __MLPACK_CORE_METRICS_LMETRIC_HPP
00026 #define __MLPACK_CORE_METRICS_LMETRIC_HPP
00027 
00028 #include <mlpack/core.hpp>
00029 
00030 namespace mlpack {
00031 namespace metric {
00032 
00072 template<int Power, bool TakeRoot = true>
00073 class LMetric
00074 {
00075  public:
00076   /***
00077    * Default constructor does nothing, but is required to satisfy the Kernel
00078    * policy.
00079    */
00080   LMetric() { }
00081 
00085   template<typename VecType1, typename VecType2>
00086   static double Evaluate(const VecType1& a, const VecType2& b);
00087 };
00088 
00089 // Convenience typedefs.
00090 
00091 /***
00092  * The Manhattan (L1) distance.
00093  */
00094 typedef LMetric<1, false> ManhattanDistance;
00095 
00096 /***
00097  * The squared Euclidean (L2) distance.
00098  */
00099 typedef LMetric<2, false> SquaredEuclideanDistance;
00100 
00101 /***
00102  * The Euclidean (L2) distance.
00103  */
00104 typedef LMetric<2, true> EuclideanDistance;
00105 
00106 /***
00107  * The L-infinity distance
00108  */
00109 typedef LMetric<INT_MAX, false> ChebyshevDistance;
00110 
00111 }; // namespace metric
00112 }; // namespace mlpack
00113 
00114 // Include implementation.
00115 #include "lmetric_impl.hpp"
00116 
00117 #endif

Generated on 29 Sep 2016 for MLPACK by  doxygen 1.6.1