diff src/Matcher.cpp @ 191:f415747b151b re-minimise

Normalised path costs should use a different type from un-normalised ones (because they are in a different range)
author Chris Cannam
date Thu, 26 Feb 2015 15:52:16 +0000
parents 487261a22b18
children b5deca82e074
line wrap: on
line diff
--- a/src/Matcher.cpp	Thu Feb 26 15:51:50 2015 +0000
+++ b/src/Matcher.cpp	Thu Feb 26 15:52:16 2015 +0000
@@ -153,7 +153,8 @@
         if (dist == InvalidDistance) {
             cerr << "ERROR: Matcher::getDistance(" << i << ", " << j << "): "
                  << "Location is in range, but distance ("
-                 << dist << ") is invalid or has not been set" << endl;
+                 << distance_print_t(dist)
+                 << ") is invalid or has not been set" << endl;
             throw "Distance not available";
         }
         return dist;
@@ -168,7 +169,8 @@
     if (m_firstPM) {
         if (!isInRange(i, j)) {
             cerr << "ERROR: Matcher::setDistance(" << i << ", " << j << ", "
-                 << distance << "): Location is out of range" << endl;
+                 << distance_print_t(distance)
+                 << "): Location is out of range" << endl;
             throw "Indices out of range";
         }
         m_distance[i][j - m_first[i]] = distance;
@@ -177,11 +179,11 @@
     }
 }
 
-pathcost_t
+normpathcost_t
 Matcher::getNormalisedPathCost(int i, int j)
 {
     // normalised for path length. 1+ prevents division by zero here
-    return getPathCost(i, j) / (1 + i + j);
+    return normpathcost_t(getPathCost(i, j)) / normpathcost_t(1 + i + j);
 }
 
 pathcost_t