diff src/DistanceMetric.h @ 157:d6c1556fadd0 refactors

Default is actually Manhattan, not Euclidean (it just looks like squared-Euclidean for energy vectors). Add Euclidean as another alternative.
author Chris Cannam
date Thu, 29 Jan 2015 10:55:24 +0000
parents d6df9fe7b12f
children 24ddab06aace
line wrap: on
line diff
--- a/src/DistanceMetric.h	Thu Jan 29 10:25:47 2015 +0000
+++ b/src/DistanceMetric.h	Thu Jan 29 10:55:24 2015 +0000
@@ -24,6 +24,12 @@
 public:
     enum Metric {
 
+        /** Calculate the Manhattan distance between feature
+         *  vectors. If the vectors contain energy, as the default
+         *  MATCH feature does, this could be considered as a squared
+         *  Euclidean distance metric. */
+        Manhattan,
+
         /** Calculate the Euclidean distance between feature vectors. */
         Euclidean,
 
@@ -60,7 +66,7 @@
     struct Parameters {
 
         Parameters() :
-            metric(Euclidean),
+            metric(Manhattan),
             norm(NormaliseDistanceToLogSum),
             noise(AddNoise)
         {}
@@ -72,11 +78,10 @@
     
     DistanceMetric(Parameters params);
     
-    /** Calculates the Manhattan distance between two vectors, with an
-     *  optional normalisation by the combined values in the
-     *  vectors. Since the vectors contain energy, this could be
-     *  considered as a squared Euclidean distance metric. Note that
-     *  normalisation assumes the values are all non-negative.
+    /** Calculates the distance in some metric between two vectors,
+     *  with an optional normalisation by the combined values in the
+     *  vectors. Note that normalisation assumes the values are all
+     *  non-negative.
      *
      *  @param f1 one of the vectors involved in the distance calculation
      *  @param f2 one of the vectors involved in the distance calculation