MLPACK
1.0.4
|
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 = false> 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 }; // namespace metric 00107 }; // namespace mlpack 00108 00109 // Include implementation. 00110 #include "lmetric_impl.hpp" 00111 00112 #endif