[mlpack-svn] r14375 - mlpack/trunk/src/mlpack/tests

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Fri Feb 22 18:15:21 EST 2013


Author: rcurtin
Date: 2013-02-22 18:15:20 -0500 (Fri, 22 Feb 2013)
New Revision: 14375

Modified:
   mlpack/trunk/src/mlpack/tests/allkfn_test.cpp
   mlpack/trunk/src/mlpack/tests/allknn_test.cpp
   mlpack/trunk/src/mlpack/tests/kernel_test.cpp
   mlpack/trunk/src/mlpack/tests/sort_policy_test.cpp
   mlpack/trunk/src/mlpack/tests/tree_test.cpp
Log:
Update tests because LMetric<2> is no longer the squared Euclidean distance.


Modified: mlpack/trunk/src/mlpack/tests/allkfn_test.cpp
===================================================================
--- mlpack/trunk/src/mlpack/tests/allkfn_test.cpp	2013-02-22 23:14:36 UTC (rev 14374)
+++ mlpack/trunk/src/mlpack/tests/allkfn_test.cpp	2013-02-22 23:15:20 UTC (rev 14375)
@@ -68,245 +68,245 @@
 
     // Neighbors of point 0.
     BOOST_REQUIRE(neighbors(9, 0) == 2);
-    BOOST_REQUIRE_CLOSE(distances(9, 0), (0.10 * 0.10), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(9, 0), 0.10, 1e-5);
     BOOST_REQUIRE(neighbors(8, 0) == 5);
-    BOOST_REQUIRE_CLOSE(distances(8, 0), (0.27 * 0.27), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(8, 0), 0.27, 1e-5);
     BOOST_REQUIRE(neighbors(7, 0) == 1);
-    BOOST_REQUIRE_CLOSE(distances(7, 0), (0.30 * 0.30), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(7, 0), 0.30, 1e-5);
     BOOST_REQUIRE(neighbors(6, 0) == 8);
-    BOOST_REQUIRE_CLOSE(distances(6, 0), (0.40 * 0.40), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(6, 0), 0.40, 1e-5);
     BOOST_REQUIRE(neighbors(5, 0) == 9);
-    BOOST_REQUIRE_CLOSE(distances(5, 0), (0.85 * 0.85), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(5, 0), 0.85, 1e-5);
     BOOST_REQUIRE(neighbors(4, 0) == 10);
-    BOOST_REQUIRE_CLOSE(distances(4, 0), (0.95 * 0.95), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(4, 0), 0.95, 1e-5);
     BOOST_REQUIRE(neighbors(3, 0) == 3);
-    BOOST_REQUIRE_CLOSE(distances(3, 0), (1.20 * 1.20), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(3, 0), 1.20, 1e-5);
     BOOST_REQUIRE(neighbors(2, 0) == 7);
-    BOOST_REQUIRE_CLOSE(distances(2, 0), (1.35 * 1.35), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(2, 0), 1.35, 1e-5);
     BOOST_REQUIRE(neighbors(1, 0) == 6);
-    BOOST_REQUIRE_CLOSE(distances(1, 0), (2.05 * 2.05), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(1, 0), 2.05, 1e-5);
     BOOST_REQUIRE(neighbors(0, 0) == 4);
-    BOOST_REQUIRE_CLOSE(distances(0, 0), (5.00 * 5.00), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(0, 0), 5.00, 1e-5);
 
     // Neighbors of point 1.
     BOOST_REQUIRE(neighbors(9, 1) == 8);
-    BOOST_REQUIRE_CLOSE(distances(9, 1), (0.10 * 0.10), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(9, 1), 0.10, 1e-5);
     BOOST_REQUIRE(neighbors(8, 1) == 2);
-    BOOST_REQUIRE_CLOSE(distances(8, 1), (0.20 * 0.20), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(8, 1), 0.20, 1e-5);
     BOOST_REQUIRE(neighbors(7, 1) == 0);
-    BOOST_REQUIRE_CLOSE(distances(7, 1), (0.30 * 0.30), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(7, 1), 0.30, 1e-5);
     BOOST_REQUIRE(neighbors(6, 1) == 9);
-    BOOST_REQUIRE_CLOSE(distances(6, 1), (0.55 * 0.55), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(6, 1), 0.55, 1e-5);
     BOOST_REQUIRE(neighbors(5, 1) == 5);
-    BOOST_REQUIRE_CLOSE(distances(5, 1), (0.57 * 0.57), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(5, 1), 0.57, 1e-5);
     BOOST_REQUIRE(neighbors(4, 1) == 10);
-    BOOST_REQUIRE_CLOSE(distances(4, 1), (0.65 * 0.65), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(4, 1), 0.65, 1e-5);
     BOOST_REQUIRE(neighbors(3, 1) == 3);
-    BOOST_REQUIRE_CLOSE(distances(3, 1), (0.90 * 0.90), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(3, 1), 0.90, 1e-5);
     BOOST_REQUIRE(neighbors(2, 1) == 7);
-    BOOST_REQUIRE_CLOSE(distances(2, 1), (1.65 * 1.65), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(2, 1), 1.65, 1e-5);
     BOOST_REQUIRE(neighbors(1, 1) == 6);
-    BOOST_REQUIRE_CLOSE(distances(1, 1), (2.35 * 2.35), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(1, 1), 2.35, 1e-5);
     BOOST_REQUIRE(neighbors(0, 1) == 4);
-    BOOST_REQUIRE_CLOSE(distances(0, 1), (4.70 * 4.70), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(0, 1), 4.70, 1e-5);
 
     // Neighbors of point 2.
     BOOST_REQUIRE(neighbors(9, 2) == 0);
-    BOOST_REQUIRE_CLOSE(distances(9, 2), (0.10 * 0.10), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(9, 2), 0.10, 1e-5);
     BOOST_REQUIRE(neighbors(8, 2) == 1);
-    BOOST_REQUIRE_CLOSE(distances(8, 2), (0.20 * 0.20), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(8, 2), 0.20, 1e-5);
     BOOST_REQUIRE(neighbors(7, 2) == 8);
-    BOOST_REQUIRE_CLOSE(distances(7, 2), (0.30 * 0.30), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(7, 2), 0.30, 1e-5);
     BOOST_REQUIRE(neighbors(6, 2) == 5);
-    BOOST_REQUIRE_CLOSE(distances(6, 2), (0.37 * 0.37), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(6, 2), 0.37, 1e-5);
     BOOST_REQUIRE(neighbors(5, 2) == 9);
-    BOOST_REQUIRE_CLOSE(distances(5, 2), (0.75 * 0.75), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(5, 2), 0.75, 1e-5);
     BOOST_REQUIRE(neighbors(4, 2) == 10);
-    BOOST_REQUIRE_CLOSE(distances(4, 2), (0.85 * 0.85), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(4, 2), 0.85, 1e-5);
     BOOST_REQUIRE(neighbors(3, 2) == 3);
-    BOOST_REQUIRE_CLOSE(distances(3, 2), (1.10 * 1.10), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(3, 2), 1.10, 1e-5);
     BOOST_REQUIRE(neighbors(2, 2) == 7);
-    BOOST_REQUIRE_CLOSE(distances(2, 2), (1.45 * 1.45), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(2, 2), 1.45, 1e-5);
     BOOST_REQUIRE(neighbors(1, 2) == 6);
-    BOOST_REQUIRE_CLOSE(distances(1, 2), (2.15 * 2.15), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(1, 2), 2.15, 1e-5);
     BOOST_REQUIRE(neighbors(0, 2) == 4);
-    BOOST_REQUIRE_CLOSE(distances(0, 2), (4.90 * 4.90), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(0, 2), 4.90, 1e-5);
 
     // Neighbors of point 3.
     BOOST_REQUIRE(neighbors(9, 3) == 10);
-    BOOST_REQUIRE_CLOSE(distances(9, 3), (0.25 * 0.25), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(9, 3), 0.25, 1e-5);
     BOOST_REQUIRE(neighbors(8, 3) == 9);
-    BOOST_REQUIRE_CLOSE(distances(8, 3), (0.35 * 0.35), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(8, 3), 0.35, 1e-5);
     BOOST_REQUIRE(neighbors(7, 3) == 8);
-    BOOST_REQUIRE_CLOSE(distances(7, 3), (0.80 * 0.80), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(7, 3), 0.80, 1e-5);
     BOOST_REQUIRE(neighbors(6, 3) == 1);
-    BOOST_REQUIRE_CLOSE(distances(6, 3), (0.90 * 0.90), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(6, 3), 0.90, 1e-5);
     BOOST_REQUIRE(neighbors(5, 3) == 2);
-    BOOST_REQUIRE_CLOSE(distances(5, 3), (1.10 * 1.10), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(5, 3), 1.10, 1e-5);
     BOOST_REQUIRE(neighbors(4, 3) == 0);
-    BOOST_REQUIRE_CLOSE(distances(4, 3), (1.20 * 1.20), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(4, 3), 1.20, 1e-5);
     BOOST_REQUIRE(neighbors(3, 3) == 5);
-    BOOST_REQUIRE_CLOSE(distances(3, 3), (1.47 * 1.47), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(3, 3), 1.47, 1e-5);
     BOOST_REQUIRE(neighbors(2, 3) == 7);
-    BOOST_REQUIRE_CLOSE(distances(2, 3), (2.55 * 2.55), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(2, 3), 2.55, 1e-5);
     BOOST_REQUIRE(neighbors(1, 3) == 6);
-    BOOST_REQUIRE_CLOSE(distances(1, 3), (3.25 * 3.25), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(1, 3), 3.25, 1e-5);
     BOOST_REQUIRE(neighbors(0, 3) == 4);
-    BOOST_REQUIRE_CLOSE(distances(0, 3), (3.80 * 3.80), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(0, 3), 3.80, 1e-5);
 
     // Neighbors of point 4.
     BOOST_REQUIRE(neighbors(9, 4) == 3);
-    BOOST_REQUIRE_CLOSE(distances(9, 4), (3.80 * 3.80), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(9, 4), 3.80, 1e-5);
     BOOST_REQUIRE(neighbors(8, 4) == 10);
-    BOOST_REQUIRE_CLOSE(distances(8, 4), (4.05 * 4.05), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(8, 4), 4.05, 1e-5);
     BOOST_REQUIRE(neighbors(7, 4) == 9);
-    BOOST_REQUIRE_CLOSE(distances(7, 4), (4.15 * 4.15), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(7, 4), 4.15, 1e-5);
     BOOST_REQUIRE(neighbors(6, 4) == 8);
-    BOOST_REQUIRE_CLOSE(distances(6, 4), (4.60 * 4.60), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(6, 4), 4.60, 1e-5);
     BOOST_REQUIRE(neighbors(5, 4) == 1);
-    BOOST_REQUIRE_CLOSE(distances(5, 4), (4.70 * 4.70), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(5, 4), 4.70, 1e-5);
     BOOST_REQUIRE(neighbors(4, 4) == 2);
-    BOOST_REQUIRE_CLOSE(distances(4, 4), (4.90 * 4.90), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(4, 4), 4.90, 1e-5);
     BOOST_REQUIRE(neighbors(3, 4) == 0);
-    BOOST_REQUIRE_CLOSE(distances(3, 4), (5.00 * 5.00), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(3, 4), 5.00, 1e-5);
     BOOST_REQUIRE(neighbors(2, 4) == 5);
-    BOOST_REQUIRE_CLOSE(distances(2, 4), (5.27 * 5.27), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(2, 4), 5.27, 1e-5);
     BOOST_REQUIRE(neighbors(1, 4) == 7);
-    BOOST_REQUIRE_CLOSE(distances(1, 4), (6.35 * 6.35), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(1, 4), 6.35, 1e-5);
     BOOST_REQUIRE(neighbors(0, 4) == 6);
-    BOOST_REQUIRE_CLOSE(distances(0, 4), (7.05 * 7.05), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(0, 4), 7.05, 1e-5);
 
     // Neighbors of point 5.
     BOOST_REQUIRE(neighbors(9, 5) == 0);
-    BOOST_REQUIRE_CLOSE(distances(9, 5), (0.27 * 0.27), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(9, 5), 0.27, 1e-5);
     BOOST_REQUIRE(neighbors(8, 5) == 2);
-    BOOST_REQUIRE_CLOSE(distances(8, 5), (0.37 * 0.37), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(8, 5), 0.37, 1e-5);
     BOOST_REQUIRE(neighbors(7, 5) == 1);
-    BOOST_REQUIRE_CLOSE(distances(7, 5), (0.57 * 0.57), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(7, 5), 0.57, 1e-5);
     BOOST_REQUIRE(neighbors(6, 5) == 8);
-    BOOST_REQUIRE_CLOSE(distances(6, 5), (0.67 * 0.67), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(6, 5), 0.67, 1e-5);
     BOOST_REQUIRE(neighbors(5, 5) == 7);
-    BOOST_REQUIRE_CLOSE(distances(5, 5), (1.08 * 1.08), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(5, 5), 1.08, 1e-5);
     BOOST_REQUIRE(neighbors(4, 5) == 9);
-    BOOST_REQUIRE_CLOSE(distances(4, 5), (1.12 * 1.12), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(4, 5), 1.12, 1e-5);
     BOOST_REQUIRE(neighbors(3, 5) == 10);
-    BOOST_REQUIRE_CLOSE(distances(3, 5), (1.22 * 1.22), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(3, 5), 1.22, 1e-5);
     BOOST_REQUIRE(neighbors(2, 5) == 3);
-    BOOST_REQUIRE_CLOSE(distances(2, 5), (1.47 * 1.47), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(2, 5), 1.47, 1e-5);
     BOOST_REQUIRE(neighbors(1, 5) == 6);
-    BOOST_REQUIRE_CLOSE(distances(1, 5), (1.78 * 1.78), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(1, 5), 1.78, 1e-5);
     BOOST_REQUIRE(neighbors(0, 5) == 4);
-    BOOST_REQUIRE_CLOSE(distances(0, 5), (5.27 * 5.27), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(0, 5), 5.27, 1e-5);
 
     // Neighbors of point 6.
     BOOST_REQUIRE(neighbors(9, 6) == 7);
-    BOOST_REQUIRE_CLOSE(distances(9, 6), (0.70 * 0.70), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(9, 6), 0.70, 1e-5);
     BOOST_REQUIRE(neighbors(8, 6) == 5);
-    BOOST_REQUIRE_CLOSE(distances(8, 6), (1.78 * 1.78), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(8, 6), 1.78, 1e-5);
     BOOST_REQUIRE(neighbors(7, 6) == 0);
-    BOOST_REQUIRE_CLOSE(distances(7, 6), (2.05 * 2.05), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(7, 6), 2.05, 1e-5);
     BOOST_REQUIRE(neighbors(6, 6) == 2);
-    BOOST_REQUIRE_CLOSE(distances(6, 6), (2.15 * 2.15), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(6, 6), 2.15, 1e-5);
     BOOST_REQUIRE(neighbors(5, 6) == 1);
-    BOOST_REQUIRE_CLOSE(distances(5, 6), (2.35 * 2.35), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(5, 6), 2.35, 1e-5);
     BOOST_REQUIRE(neighbors(4, 6) == 8);
-    BOOST_REQUIRE_CLOSE(distances(4, 6), (2.45 * 2.45), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(4, 6), 2.45, 1e-5);
     BOOST_REQUIRE(neighbors(3, 6) == 9);
-    BOOST_REQUIRE_CLOSE(distances(3, 6), (2.90 * 2.90), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(3, 6), 2.90, 1e-5);
     BOOST_REQUIRE(neighbors(2, 6) == 10);
-    BOOST_REQUIRE_CLOSE(distances(2, 6), (3.00 * 3.00), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(2, 6), 3.00, 1e-5);
     BOOST_REQUIRE(neighbors(1, 6) == 3);
-    BOOST_REQUIRE_CLOSE(distances(1, 6), (3.25 * 3.25), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(1, 6), 3.25, 1e-5);
     BOOST_REQUIRE(neighbors(0, 6) == 4);
-    BOOST_REQUIRE_CLOSE(distances(0, 6), (7.05 * 7.05), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(0, 6), 7.05, 1e-5);
 
     // Neighbors of point 7.
     BOOST_REQUIRE(neighbors(9, 7) == 6);
-    BOOST_REQUIRE_CLOSE(distances(9, 7), (0.70 * 0.70), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(9, 7), 0.70, 1e-5);
     BOOST_REQUIRE(neighbors(8, 7) == 5);
-    BOOST_REQUIRE_CLOSE(distances(8, 7), (1.08 * 1.08), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(8, 7), 1.08, 1e-5);
     BOOST_REQUIRE(neighbors(7, 7) == 0);
-    BOOST_REQUIRE_CLOSE(distances(7, 7), (1.35 * 1.35), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(7, 7), 1.35, 1e-5);
     BOOST_REQUIRE(neighbors(6, 7) == 2);
-    BOOST_REQUIRE_CLOSE(distances(6, 7), (1.45 * 1.45), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(6, 7), 1.45, 1e-5);
     BOOST_REQUIRE(neighbors(5, 7) == 1);
-    BOOST_REQUIRE_CLOSE(distances(5, 7), (1.65 * 1.65), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(5, 7), 1.65, 1e-5);
     BOOST_REQUIRE(neighbors(4, 7) == 8);
-    BOOST_REQUIRE_CLOSE(distances(4, 7), (1.75 * 1.75), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(4, 7), 1.75, 1e-5);
     BOOST_REQUIRE(neighbors(3, 7) == 9);
-    BOOST_REQUIRE_CLOSE(distances(3, 7), (2.20 * 2.20), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(3, 7), 2.20, 1e-5);
     BOOST_REQUIRE(neighbors(2, 7) == 10);
-    BOOST_REQUIRE_CLOSE(distances(2, 7), (2.30 * 2.30), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(2, 7), 2.30, 1e-5);
     BOOST_REQUIRE(neighbors(1, 7) == 3);
-    BOOST_REQUIRE_CLOSE(distances(1, 7), (2.55 * 2.55), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(1, 7), 2.55, 1e-5);
     BOOST_REQUIRE(neighbors(0, 7) == 4);
-    BOOST_REQUIRE_CLOSE(distances(0, 7), (6.35 * 6.35), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(0, 7), 6.35, 1e-5);
 
     // Neighbors of point 8.
     BOOST_REQUIRE(neighbors(9, 8) == 1);
-    BOOST_REQUIRE_CLOSE(distances(9, 8), (0.10 * 0.10), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(9, 8), 0.10, 1e-5);
     BOOST_REQUIRE(neighbors(8, 8) == 2);
-    BOOST_REQUIRE_CLOSE(distances(8, 8), (0.30 * 0.30), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(8, 8), 0.30, 1e-5);
     BOOST_REQUIRE(neighbors(7, 8) == 0);
-    BOOST_REQUIRE_CLOSE(distances(7, 8), (0.40 * 0.40), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(7, 8), 0.40, 1e-5);
     BOOST_REQUIRE(neighbors(6, 8) == 9);
-    BOOST_REQUIRE_CLOSE(distances(6, 8), (0.45 * 0.45), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(6, 8), 0.45, 1e-5);
     BOOST_REQUIRE(neighbors(5, 8) == 10);
-    BOOST_REQUIRE_CLOSE(distances(5, 8), (0.55 * 0.55), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(5, 8), 0.55, 1e-5);
     BOOST_REQUIRE(neighbors(4, 8) == 5);
-    BOOST_REQUIRE_CLOSE(distances(4, 8), (0.67 * 0.67), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(4, 8), 0.67, 1e-5);
     BOOST_REQUIRE(neighbors(3, 8) == 3);
-    BOOST_REQUIRE_CLOSE(distances(3, 8), (0.80 * 0.80), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(3, 8), 0.80, 1e-5);
     BOOST_REQUIRE(neighbors(2, 8) == 7);
-    BOOST_REQUIRE_CLOSE(distances(2, 8), (1.75 * 1.75), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(2, 8), 1.75, 1e-5);
     BOOST_REQUIRE(neighbors(1, 8) == 6);
-    BOOST_REQUIRE_CLOSE(distances(1, 8), (2.45 * 2.45), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(1, 8), 2.45, 1e-5);
     BOOST_REQUIRE(neighbors(0, 8) == 4);
-    BOOST_REQUIRE_CLOSE(distances(0, 8), (4.60 * 4.60), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(0, 8), 4.60, 1e-5);
 
     // Neighbors of point 9.
     BOOST_REQUIRE(neighbors(9, 9) == 10);
-    BOOST_REQUIRE_CLOSE(distances(9, 9), (0.10 * 0.10), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(9, 9), 0.10, 1e-5);
     BOOST_REQUIRE(neighbors(8, 9) == 3);
-    BOOST_REQUIRE_CLOSE(distances(8, 9), (0.35 * 0.35), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(8, 9), 0.35, 1e-5);
     BOOST_REQUIRE(neighbors(7, 9) == 8);
-    BOOST_REQUIRE_CLOSE(distances(7, 9), (0.45 * 0.45), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(7, 9), 0.45, 1e-5);
     BOOST_REQUIRE(neighbors(6, 9) == 1);
-    BOOST_REQUIRE_CLOSE(distances(6, 9), (0.55 * 0.55), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(6, 9), 0.55, 1e-5);
     BOOST_REQUIRE(neighbors(5, 9) == 2);
-    BOOST_REQUIRE_CLOSE(distances(5, 9), (0.75 * 0.75), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(5, 9), 0.75, 1e-5);
     BOOST_REQUIRE(neighbors(4, 9) == 0);
-    BOOST_REQUIRE_CLOSE(distances(4, 9), (0.85 * 0.85), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(4, 9), 0.85, 1e-5);
     BOOST_REQUIRE(neighbors(3, 9) == 5);
-    BOOST_REQUIRE_CLOSE(distances(3, 9), (1.12 * 1.12), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(3, 9), 1.12, 1e-5);
     BOOST_REQUIRE(neighbors(2, 9) == 7);
-    BOOST_REQUIRE_CLOSE(distances(2, 9), (2.20 * 2.20), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(2, 9), 2.20, 1e-5);
     BOOST_REQUIRE(neighbors(1, 9) == 6);
-    BOOST_REQUIRE_CLOSE(distances(1, 9), (2.90 * 2.90), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(1, 9), 2.90, 1e-5);
     BOOST_REQUIRE(neighbors(0, 9) == 4);
-    BOOST_REQUIRE_CLOSE(distances(0, 9), (4.15 * 4.15), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(0, 9), 4.15, 1e-5);
 
     // Neighbors of point 10.
     BOOST_REQUIRE(neighbors(9, 10) == 9);
-    BOOST_REQUIRE_CLOSE(distances(9, 10), (0.10 * 0.10), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(9, 10), 0.10, 1e-5);
     BOOST_REQUIRE(neighbors(8, 10) == 3);
-    BOOST_REQUIRE_CLOSE(distances(8, 10), (0.25 * 0.25), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(8, 10), 0.25, 1e-5);
     BOOST_REQUIRE(neighbors(7, 10) == 8);
-    BOOST_REQUIRE_CLOSE(distances(7, 10), (0.55 * 0.55), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(7, 10), 0.55, 1e-5);
     BOOST_REQUIRE(neighbors(6, 10) == 1);
-    BOOST_REQUIRE_CLOSE(distances(6, 10), (0.65 * 0.65), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(6, 10), 0.65, 1e-5);
     BOOST_REQUIRE(neighbors(5, 10) == 2);
-    BOOST_REQUIRE_CLOSE(distances(5, 10), (0.85 * 0.85), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(5, 10), 0.85, 1e-5);
     BOOST_REQUIRE(neighbors(4, 10) == 0);
-    BOOST_REQUIRE_CLOSE(distances(4, 10), (0.95 * 0.95), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(4, 10), 0.95, 1e-5);
     BOOST_REQUIRE(neighbors(3, 10) == 5);
-    BOOST_REQUIRE_CLOSE(distances(3, 10), (1.22 * 1.22), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(3, 10), 1.22, 1e-5);
     BOOST_REQUIRE(neighbors(2, 10) == 7);
-    BOOST_REQUIRE_CLOSE(distances(2, 10), (2.30 * 2.30), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(2, 10), 2.30, 1e-5);
     BOOST_REQUIRE(neighbors(1, 10) == 6);
-    BOOST_REQUIRE_CLOSE(distances(1, 10), (3.00 * 3.00), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(1, 10), 3.00, 1e-5);
     BOOST_REQUIRE(neighbors(0, 10) == 4);
-    BOOST_REQUIRE_CLOSE(distances(0, 10), (4.05 * 4.05), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(0, 10), 4.05, 1e-5);
 
     // Clean the memory.
     delete allkfn;

Modified: mlpack/trunk/src/mlpack/tests/allknn_test.cpp
===================================================================
--- mlpack/trunk/src/mlpack/tests/allknn_test.cpp	2013-02-22 23:14:36 UTC (rev 14374)
+++ mlpack/trunk/src/mlpack/tests/allknn_test.cpp	2013-02-22 23:15:20 UTC (rev 14375)
@@ -211,245 +211,245 @@
 
     // Neighbors of point 0.
     BOOST_REQUIRE(neighbors(0, 0) == 2);
-    BOOST_REQUIRE_CLOSE(distances(0, 0), (0.10 * 0.10), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(0, 0), 0.10, 1e-5);
     BOOST_REQUIRE(neighbors(1, 0) == 5);
-    BOOST_REQUIRE_CLOSE(distances(1, 0), (0.27 * 0.27), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(1, 0), 0.27, 1e-5);
     BOOST_REQUIRE(neighbors(2, 0) == 1);
-    BOOST_REQUIRE_CLOSE(distances(2, 0), (0.30 * 0.30), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(2, 0), 0.30, 1e-5);
     BOOST_REQUIRE(neighbors(3, 0) == 8);
-    BOOST_REQUIRE_CLOSE(distances(3, 0), (0.40 * 0.40), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(3, 0), 0.40, 1e-5);
     BOOST_REQUIRE(neighbors(4, 0) == 9);
-    BOOST_REQUIRE_CLOSE(distances(4, 0), (0.85 * 0.85), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(4, 0), 0.85, 1e-5);
     BOOST_REQUIRE(neighbors(5, 0) == 10);
-    BOOST_REQUIRE_CLOSE(distances(5, 0), (0.95 * 0.95), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(5, 0), 0.95, 1e-5);
     BOOST_REQUIRE(neighbors(6, 0) == 3);
-    BOOST_REQUIRE_CLOSE(distances(6, 0), (1.20 * 1.20), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(6, 0), 1.20, 1e-5);
     BOOST_REQUIRE(neighbors(7, 0) == 7);
-    BOOST_REQUIRE_CLOSE(distances(7, 0), (1.35 * 1.35), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(7, 0), 1.35, 1e-5);
     BOOST_REQUIRE(neighbors(8, 0) == 6);
-    BOOST_REQUIRE_CLOSE(distances(8, 0), (2.05 * 2.05), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(8, 0), 2.05, 1e-5);
     BOOST_REQUIRE(neighbors(9, 0) == 4);
-    BOOST_REQUIRE_CLOSE(distances(9, 0), (5.00 * 5.00), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(9, 0), 5.00, 1e-5);
 
     // Neighbors of point 1.
     BOOST_REQUIRE(neighbors(0, 1) == 8);
-    BOOST_REQUIRE_CLOSE(distances(0, 1), (0.10 * 0.10), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(0, 1), 0.10, 1e-5);
     BOOST_REQUIRE(neighbors(1, 1) == 2);
-    BOOST_REQUIRE_CLOSE(distances(1, 1), (0.20 * 0.20), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(1, 1), 0.20, 1e-5);
     BOOST_REQUIRE(neighbors(2, 1) == 0);
-    BOOST_REQUIRE_CLOSE(distances(2, 1), (0.30 * 0.30), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(2, 1), 0.30, 1e-5);
     BOOST_REQUIRE(neighbors(3, 1) == 9);
-    BOOST_REQUIRE_CLOSE(distances(3, 1), (0.55 * 0.55), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(3, 1), 0.55, 1e-5);
     BOOST_REQUIRE(neighbors(4, 1) == 5);
-    BOOST_REQUIRE_CLOSE(distances(4, 1), (0.57 * 0.57), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(4, 1), 0.57, 1e-5);
     BOOST_REQUIRE(neighbors(5, 1) == 10);
-    BOOST_REQUIRE_CLOSE(distances(5, 1), (0.65 * 0.65), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(5, 1), 0.65, 1e-5);
     BOOST_REQUIRE(neighbors(6, 1) == 3);
-    BOOST_REQUIRE_CLOSE(distances(6, 1), (0.90 * 0.90), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(6, 1), 0.90, 1e-5);
     BOOST_REQUIRE(neighbors(7, 1) == 7);
-    BOOST_REQUIRE_CLOSE(distances(7, 1), (1.65 * 1.65), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(7, 1), 1.65, 1e-5);
     BOOST_REQUIRE(neighbors(8, 1) == 6);
-    BOOST_REQUIRE_CLOSE(distances(8, 1), (2.35 * 2.35), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(8, 1), 2.35, 1e-5);
     BOOST_REQUIRE(neighbors(9, 1) == 4);
-    BOOST_REQUIRE_CLOSE(distances(9, 1), (4.70 * 4.70), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(9, 1), 4.70, 1e-5);
 
     // Neighbors of point 2.
     BOOST_REQUIRE(neighbors(0, 2) == 0);
-    BOOST_REQUIRE_CLOSE(distances(0, 2), (0.10 * 0.10), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(0, 2), 0.10, 1e-5);
     BOOST_REQUIRE(neighbors(1, 2) == 1);
-    BOOST_REQUIRE_CLOSE(distances(1, 2), (0.20 * 0.20), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(1, 2), 0.20, 1e-5);
     BOOST_REQUIRE(neighbors(2, 2) == 8);
-    BOOST_REQUIRE_CLOSE(distances(2, 2), (0.30 * 0.30), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(2, 2), 0.30, 1e-5);
     BOOST_REQUIRE(neighbors(3, 2) == 5);
-    BOOST_REQUIRE_CLOSE(distances(3, 2), (0.37 * 0.37), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(3, 2), 0.37, 1e-5);
     BOOST_REQUIRE(neighbors(4, 2) == 9);
-    BOOST_REQUIRE_CLOSE(distances(4, 2), (0.75 * 0.75), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(4, 2), 0.75, 1e-5);
     BOOST_REQUIRE(neighbors(5, 2) == 10);
-    BOOST_REQUIRE_CLOSE(distances(5, 2), (0.85 * 0.85), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(5, 2), 0.85, 1e-5);
     BOOST_REQUIRE(neighbors(6, 2) == 3);
-    BOOST_REQUIRE_CLOSE(distances(6, 2), (1.10 * 1.10), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(6, 2), 1.10, 1e-5);
     BOOST_REQUIRE(neighbors(7, 2) == 7);
-    BOOST_REQUIRE_CLOSE(distances(7, 2), (1.45 * 1.45), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(7, 2), 1.45, 1e-5);
     BOOST_REQUIRE(neighbors(8, 2) == 6);
-    BOOST_REQUIRE_CLOSE(distances(8, 2), (2.15 * 2.15), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(8, 2), 2.15, 1e-5);
     BOOST_REQUIRE(neighbors(9, 2) == 4);
-    BOOST_REQUIRE_CLOSE(distances(9, 2), (4.90 * 4.90), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(9, 2), 4.90, 1e-5);
 
     // Neighbors of point 3.
     BOOST_REQUIRE(neighbors(0, 3) == 10);
-    BOOST_REQUIRE_CLOSE(distances(0, 3), (0.25 * 0.25), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(0, 3), 0.25, 1e-5);
     BOOST_REQUIRE(neighbors(1, 3) == 9);
-    BOOST_REQUIRE_CLOSE(distances(1, 3), (0.35 * 0.35), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(1, 3), 0.35, 1e-5);
     BOOST_REQUIRE(neighbors(2, 3) == 8);
-    BOOST_REQUIRE_CLOSE(distances(2, 3), (0.80 * 0.80), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(2, 3), 0.80, 1e-5);
     BOOST_REQUIRE(neighbors(3, 3) == 1);
-    BOOST_REQUIRE_CLOSE(distances(3, 3), (0.90 * 0.90), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(3, 3), 0.90, 1e-5);
     BOOST_REQUIRE(neighbors(4, 3) == 2);
-    BOOST_REQUIRE_CLOSE(distances(4, 3), (1.10 * 1.10), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(4, 3), 1.10, 1e-5);
     BOOST_REQUIRE(neighbors(5, 3) == 0);
-    BOOST_REQUIRE_CLOSE(distances(5, 3), (1.20 * 1.20), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(5, 3), 1.20, 1e-5);
     BOOST_REQUIRE(neighbors(6, 3) == 5);
-    BOOST_REQUIRE_CLOSE(distances(6, 3), (1.47 * 1.47), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(6, 3), 1.47, 1e-5);
     BOOST_REQUIRE(neighbors(7, 3) == 7);
-    BOOST_REQUIRE_CLOSE(distances(7, 3), (2.55 * 2.55), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(7, 3), 2.55, 1e-5);
     BOOST_REQUIRE(neighbors(8, 3) == 6);
-    BOOST_REQUIRE_CLOSE(distances(8, 3), (3.25 * 3.25), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(8, 3), 3.25, 1e-5);
     BOOST_REQUIRE(neighbors(9, 3) == 4);
-    BOOST_REQUIRE_CLOSE(distances(9, 3), (3.80 * 3.80), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(9, 3), 3.80, 1e-5);
 
     // Neighbors of point 4.
     BOOST_REQUIRE(neighbors(0, 4) == 3);
-    BOOST_REQUIRE_CLOSE(distances(0, 4), (3.80 * 3.80), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(0, 4), 3.80, 1e-5);
     BOOST_REQUIRE(neighbors(1, 4) == 10);
-    BOOST_REQUIRE_CLOSE(distances(1, 4), (4.05 * 4.05), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(1, 4), 4.05, 1e-5);
     BOOST_REQUIRE(neighbors(2, 4) == 9);
-    BOOST_REQUIRE_CLOSE(distances(2, 4), (4.15 * 4.15), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(2, 4), 4.15, 1e-5);
     BOOST_REQUIRE(neighbors(3, 4) == 8);
-    BOOST_REQUIRE_CLOSE(distances(3, 4), (4.60 * 4.60), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(3, 4), 4.60, 1e-5);
     BOOST_REQUIRE(neighbors(4, 4) == 1);
-    BOOST_REQUIRE_CLOSE(distances(4, 4), (4.70 * 4.70), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(4, 4), 4.70, 1e-5);
     BOOST_REQUIRE(neighbors(5, 4) == 2);
-    BOOST_REQUIRE_CLOSE(distances(5, 4), (4.90 * 4.90), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(5, 4), 4.90, 1e-5);
     BOOST_REQUIRE(neighbors(6, 4) == 0);
-    BOOST_REQUIRE_CLOSE(distances(6, 4), (5.00 * 5.00), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(6, 4), 5.00, 1e-5);
     BOOST_REQUIRE(neighbors(7, 4) == 5);
-    BOOST_REQUIRE_CLOSE(distances(7, 4), (5.27 * 5.27), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(7, 4), 5.27, 1e-5);
     BOOST_REQUIRE(neighbors(8, 4) == 7);
-    BOOST_REQUIRE_CLOSE(distances(8, 4), (6.35 * 6.35), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(8, 4), 6.35, 1e-5);
     BOOST_REQUIRE(neighbors(9, 4) == 6);
-    BOOST_REQUIRE_CLOSE(distances(9, 4), (7.05 * 7.05), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(9, 4), 7.05, 1e-5);
 
     // Neighbors of point 5.
     BOOST_REQUIRE(neighbors(0, 5) == 0);
-    BOOST_REQUIRE_CLOSE(distances(0, 5), (0.27 * 0.27), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(0, 5), 0.27, 1e-5);
     BOOST_REQUIRE(neighbors(1, 5) == 2);
-    BOOST_REQUIRE_CLOSE(distances(1, 5), (0.37 * 0.37), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(1, 5), 0.37, 1e-5);
     BOOST_REQUIRE(neighbors(2, 5) == 1);
-    BOOST_REQUIRE_CLOSE(distances(2, 5), (0.57 * 0.57), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(2, 5), 0.57, 1e-5);
     BOOST_REQUIRE(neighbors(3, 5) == 8);
-    BOOST_REQUIRE_CLOSE(distances(3, 5), (0.67 * 0.67), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(3, 5), 0.67, 1e-5);
     BOOST_REQUIRE(neighbors(4, 5) == 7);
-    BOOST_REQUIRE_CLOSE(distances(4, 5), (1.08 * 1.08), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(4, 5), 1.08, 1e-5);
     BOOST_REQUIRE(neighbors(5, 5) == 9);
-    BOOST_REQUIRE_CLOSE(distances(5, 5), (1.12 * 1.12), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(5, 5), 1.12, 1e-5);
     BOOST_REQUIRE(neighbors(6, 5) == 10);
-    BOOST_REQUIRE_CLOSE(distances(6, 5), (1.22 * 1.22), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(6, 5), 1.22, 1e-5);
     BOOST_REQUIRE(neighbors(7, 5) == 3);
-    BOOST_REQUIRE_CLOSE(distances(7, 5), (1.47 * 1.47), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(7, 5), 1.47, 1e-5);
     BOOST_REQUIRE(neighbors(8, 5) == 6);
-    BOOST_REQUIRE_CLOSE(distances(8, 5), (1.78 * 1.78), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(8, 5), 1.78, 1e-5);
     BOOST_REQUIRE(neighbors(9, 5) == 4);
-    BOOST_REQUIRE_CLOSE(distances(9, 5), (5.27 * 5.27), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(9, 5), 5.27, 1e-5);
 
     // Neighbors of point 6.
     BOOST_REQUIRE(neighbors(0, 6) == 7);
-    BOOST_REQUIRE_CLOSE(distances(0, 6), (0.70 * 0.70), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(0, 6), 0.70, 1e-5);
     BOOST_REQUIRE(neighbors(1, 6) == 5);
-    BOOST_REQUIRE_CLOSE(distances(1, 6), (1.78 * 1.78), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(1, 6), 1.78, 1e-5);
     BOOST_REQUIRE(neighbors(2, 6) == 0);
-    BOOST_REQUIRE_CLOSE(distances(2, 6), (2.05 * 2.05), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(2, 6), 2.05, 1e-5);
     BOOST_REQUIRE(neighbors(3, 6) == 2);
-    BOOST_REQUIRE_CLOSE(distances(3, 6), (2.15 * 2.15), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(3, 6), 2.15, 1e-5);
     BOOST_REQUIRE(neighbors(4, 6) == 1);
-    BOOST_REQUIRE_CLOSE(distances(4, 6), (2.35 * 2.35), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(4, 6), 2.35, 1e-5);
     BOOST_REQUIRE(neighbors(5, 6) == 8);
-    BOOST_REQUIRE_CLOSE(distances(5, 6), (2.45 * 2.45), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(5, 6), 2.45, 1e-5);
     BOOST_REQUIRE(neighbors(6, 6) == 9);
-    BOOST_REQUIRE_CLOSE(distances(6, 6), (2.90 * 2.90), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(6, 6), 2.90, 1e-5);
     BOOST_REQUIRE(neighbors(7, 6) == 10);
-    BOOST_REQUIRE_CLOSE(distances(7, 6), (3.00 * 3.00), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(7, 6), 3.00, 1e-5);
     BOOST_REQUIRE(neighbors(8, 6) == 3);
-    BOOST_REQUIRE_CLOSE(distances(8, 6), (3.25 * 3.25), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(8, 6), 3.25, 1e-5);
     BOOST_REQUIRE(neighbors(9, 6) == 4);
-    BOOST_REQUIRE_CLOSE(distances(9, 6), (7.05 * 7.05), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(9, 6), 7.05, 1e-5);
 
     // Neighbors of point 7.
     BOOST_REQUIRE(neighbors(0, 7) == 6);
-    BOOST_REQUIRE_CLOSE(distances(0, 7), (0.70 * 0.70), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(0, 7), 0.70, 1e-5);
     BOOST_REQUIRE(neighbors(1, 7) == 5);
-    BOOST_REQUIRE_CLOSE(distances(1, 7), (1.08 * 1.08), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(1, 7), 1.08, 1e-5);
     BOOST_REQUIRE(neighbors(2, 7) == 0);
-    BOOST_REQUIRE_CLOSE(distances(2, 7), (1.35 * 1.35), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(2, 7), 1.35, 1e-5);
     BOOST_REQUIRE(neighbors(3, 7) == 2);
-    BOOST_REQUIRE_CLOSE(distances(3, 7), (1.45 * 1.45), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(3, 7), 1.45, 1e-5);
     BOOST_REQUIRE(neighbors(4, 7) == 1);
-    BOOST_REQUIRE_CLOSE(distances(4, 7), (1.65 * 1.65), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(4, 7), 1.65, 1e-5);
     BOOST_REQUIRE(neighbors(5, 7) == 8);
-    BOOST_REQUIRE_CLOSE(distances(5, 7), (1.75 * 1.75), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(5, 7), 1.75, 1e-5);
     BOOST_REQUIRE(neighbors(6, 7) == 9);
-    BOOST_REQUIRE_CLOSE(distances(6, 7), (2.20 * 2.20), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(6, 7), 2.20, 1e-5);
     BOOST_REQUIRE(neighbors(7, 7) == 10);
-    BOOST_REQUIRE_CLOSE(distances(7, 7), (2.30 * 2.30), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(7, 7), 2.30, 1e-5);
     BOOST_REQUIRE(neighbors(8, 7) == 3);
-    BOOST_REQUIRE_CLOSE(distances(8, 7), (2.55 * 2.55), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(8, 7), 2.55, 1e-5);
     BOOST_REQUIRE(neighbors(9, 7) == 4);
-    BOOST_REQUIRE_CLOSE(distances(9, 7), (6.35 * 6.35), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(9, 7), 6.35, 1e-5);
 
     // Neighbors of point 8.
     BOOST_REQUIRE(neighbors(0, 8) == 1);
-    BOOST_REQUIRE_CLOSE(distances(0, 8), (0.10 * 0.10), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(0, 8), 0.10, 1e-5);
     BOOST_REQUIRE(neighbors(1, 8) == 2);
-    BOOST_REQUIRE_CLOSE(distances(1, 8), (0.30 * 0.30), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(1, 8), 0.30, 1e-5);
     BOOST_REQUIRE(neighbors(2, 8) == 0);
-    BOOST_REQUIRE_CLOSE(distances(2, 8), (0.40 * 0.40), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(2, 8), 0.40, 1e-5);
     BOOST_REQUIRE(neighbors(3, 8) == 9);
-    BOOST_REQUIRE_CLOSE(distances(3, 8), (0.45 * 0.45), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(3, 8), 0.45, 1e-5);
     BOOST_REQUIRE(neighbors(4, 8) == 10);
-    BOOST_REQUIRE_CLOSE(distances(4, 8), (0.55 * 0.55), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(4, 8), 0.55, 1e-5);
     BOOST_REQUIRE(neighbors(5, 8) == 5);
-    BOOST_REQUIRE_CLOSE(distances(5, 8), (0.67 * 0.67), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(5, 8), 0.67, 1e-5);
     BOOST_REQUIRE(neighbors(6, 8) == 3);
-    BOOST_REQUIRE_CLOSE(distances(6, 8), (0.80 * 0.80), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(6, 8), 0.80, 1e-5);
     BOOST_REQUIRE(neighbors(7, 8) == 7);
-    BOOST_REQUIRE_CLOSE(distances(7, 8), (1.75 * 1.75), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(7, 8), 1.75, 1e-5);
     BOOST_REQUIRE(neighbors(8, 8) == 6);
-    BOOST_REQUIRE_CLOSE(distances(8, 8), (2.45 * 2.45), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(8, 8), 2.45, 1e-5);
     BOOST_REQUIRE(neighbors(9, 8) == 4);
-    BOOST_REQUIRE_CLOSE(distances(9, 8), (4.60 * 4.60), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(9, 8), 4.60, 1e-5);
 
     // Neighbors of point 9.
     BOOST_REQUIRE(neighbors(0, 9) == 10);
-    BOOST_REQUIRE_CLOSE(distances(0, 9), (0.10 * 0.10), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(0, 9), 0.10, 1e-5);
     BOOST_REQUIRE(neighbors(1, 9) == 3);
-    BOOST_REQUIRE_CLOSE(distances(1, 9), (0.35 * 0.35), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(1, 9), 0.35, 1e-5);
     BOOST_REQUIRE(neighbors(2, 9) == 8);
-    BOOST_REQUIRE_CLOSE(distances(2, 9), (0.45 * 0.45), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(2, 9), 0.45, 1e-5);
     BOOST_REQUIRE(neighbors(3, 9) == 1);
-    BOOST_REQUIRE_CLOSE(distances(3, 9), (0.55 * 0.55), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(3, 9), 0.55, 1e-5);
     BOOST_REQUIRE(neighbors(4, 9) == 2);
-    BOOST_REQUIRE_CLOSE(distances(4, 9), (0.75 * 0.75), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(4, 9), 0.75, 1e-5);
     BOOST_REQUIRE(neighbors(5, 9) == 0);
-    BOOST_REQUIRE_CLOSE(distances(5, 9), (0.85 * 0.85), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(5, 9), 0.85, 1e-5);
     BOOST_REQUIRE(neighbors(6, 9) == 5);
-    BOOST_REQUIRE_CLOSE(distances(6, 9), (1.12 * 1.12), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(6, 9), 1.12, 1e-5);
     BOOST_REQUIRE(neighbors(7, 9) == 7);
-    BOOST_REQUIRE_CLOSE(distances(7, 9), (2.20 * 2.20), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(7, 9), 2.20, 1e-5);
     BOOST_REQUIRE(neighbors(8, 9) == 6);
-    BOOST_REQUIRE_CLOSE(distances(8, 9), (2.90 * 2.90), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(8, 9), 2.90, 1e-5);
     BOOST_REQUIRE(neighbors(9, 9) == 4);
-    BOOST_REQUIRE_CLOSE(distances(9, 9), (4.15 * 4.15), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(9, 9), 4.15, 1e-5);
 
     // Neighbors of point 10.
     BOOST_REQUIRE(neighbors(0, 10) == 9);
-    BOOST_REQUIRE_CLOSE(distances(0, 10), (0.10 * 0.10), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(0, 10), 0.10, 1e-5);
     BOOST_REQUIRE(neighbors(1, 10) == 3);
-    BOOST_REQUIRE_CLOSE(distances(1, 10), (0.25 * 0.25), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(1, 10), 0.25, 1e-5);
     BOOST_REQUIRE(neighbors(2, 10) == 8);
-    BOOST_REQUIRE_CLOSE(distances(2, 10), (0.55 * 0.55), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(2, 10), 0.55, 1e-5);
     BOOST_REQUIRE(neighbors(3, 10) == 1);
-    BOOST_REQUIRE_CLOSE(distances(3, 10), (0.65 * 0.65), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(3, 10), 0.65, 1e-5);
     BOOST_REQUIRE(neighbors(4, 10) == 2);
-    BOOST_REQUIRE_CLOSE(distances(4, 10), (0.85 * 0.85), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(4, 10), 0.85, 1e-5);
     BOOST_REQUIRE(neighbors(5, 10) == 0);
-    BOOST_REQUIRE_CLOSE(distances(5, 10), (0.95 * 0.95), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(5, 10), 0.95, 1e-5);
     BOOST_REQUIRE(neighbors(6, 10) == 5);
-    BOOST_REQUIRE_CLOSE(distances(6, 10), (1.22 * 1.22), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(6, 10), 1.22, 1e-5);
     BOOST_REQUIRE(neighbors(7, 10) == 7);
-    BOOST_REQUIRE_CLOSE(distances(7, 10), (2.30 * 2.30), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(7, 10), 2.30, 1e-5);
     BOOST_REQUIRE(neighbors(8, 10) == 6);
-    BOOST_REQUIRE_CLOSE(distances(8, 10), (3.00 * 3.00), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(8, 10), 3.00, 1e-5);
     BOOST_REQUIRE(neighbors(9, 10) == 4);
-    BOOST_REQUIRE_CLOSE(distances(9, 10), (4.05 * 4.05), 1e-5);
+    BOOST_REQUIRE_CLOSE(distances(9, 10), 4.05, 1e-5);
 
     // Clean the memory.
     delete allknn;
@@ -659,7 +659,7 @@
     for (size_t j = 0; j < coverNeighbors.n_rows; ++j)
     {
       BOOST_REQUIRE_EQUAL(coverNeighbors(j, i), kdNeighbors(j, i));
-      BOOST_REQUIRE_CLOSE(coverDistances(j, i), sqrt(kdDistances(j, i)), 1e-5);
+      BOOST_REQUIRE_CLOSE(coverDistances(j, i), kdDistances(j, i), 1e-5);
     }
   }
 }

Modified: mlpack/trunk/src/mlpack/tests/kernel_test.cpp
===================================================================
--- mlpack/trunk/src/mlpack/tests/kernel_test.cpp	2013-02-22 23:14:36 UTC (rev 14374)
+++ mlpack/trunk/src/mlpack/tests/kernel_test.cpp	2013-02-22 23:15:20 UTC (rev 14375)
@@ -77,8 +77,8 @@
   arma::vec a = "3.0 5.0 6.0 7.0";
   arma::vec b = "1.0 2.0 1.0 0.0";
 
-  BOOST_REQUIRE_CLOSE(LMetric<3>::Evaluate(a, b), 503.0, 1e-5);
-  BOOST_REQUIRE_CLOSE(LMetric<3>::Evaluate(b, a), 503.0, 1e-5);
+  BOOST_REQUIRE_CLOSE((LMetric<3, false>::Evaluate(a, b)), 503.0, 1e-5);
+  BOOST_REQUIRE_CLOSE((LMetric<3, false>::Evaluate(b, a)), 503.0, 1e-5);
 
   BOOST_REQUIRE_CLOSE((LMetric<3, true>::Evaluate(a, b)), 7.95284762, 1e-5);
   BOOST_REQUIRE_CLOSE((LMetric<3, true>::Evaluate(b, a)), 7.95284762, 1e-5);

Modified: mlpack/trunk/src/mlpack/tests/sort_policy_test.cpp
===================================================================
--- mlpack/trunk/src/mlpack/tests/sort_policy_test.cpp	2013-02-22 23:14:36 UTC (rev 14374)
+++ mlpack/trunk/src/mlpack/tests/sort_policy_test.cpp	2013-02-22 23:15:20 UTC (rev 14375)
@@ -111,9 +111,9 @@
   utility[0] = 6;
   nodeTwo.Bound() |= utility;
 
-  // This should use the L2 squared distance.
+  // This should use the L2 distance.
   BOOST_REQUIRE_CLOSE(NearestNeighborSort::BestNodeToNodeDistance(&nodeOne,
-      &nodeTwo), 16.0, 1e-5);
+      &nodeTwo), 4.0, 1e-5);
 
   // And another just to be sure, from the other side.
   nodeTwo.Bound().Clear();
@@ -122,7 +122,7 @@
   utility[0] = -1;
   nodeTwo.Bound() |= utility;
 
-  // Again, the distance is the L2 squared distance.
+  // Again, the distance is the L2 distance.
   BOOST_REQUIRE_CLOSE(NearestNeighborSort::BestNodeToNodeDistance(&nodeOne,
       &nodeTwo), 1.0, 1e-5);
 
@@ -133,8 +133,8 @@
   utility[0] = 0.5;
   nodeTwo.Bound() |= utility;
 
-  BOOST_REQUIRE_CLOSE(NearestNeighborSort::BestNodeToNodeDistance(&nodeOne,
-      &nodeTwo), 0.0, 1e-5);
+  BOOST_REQUIRE_SMALL(NearestNeighborSort::BestNodeToNodeDistance(&nodeOne,
+      &nodeTwo), 1e-5);
 }
 
 /**
@@ -157,21 +157,21 @@
   arma::vec point(1);
   point[0] = -0.5;
 
-  // The distance is the L2 squared distance.
+  // The distance is the L2 distance.
   BOOST_REQUIRE_CLOSE(NearestNeighborSort::BestPointToNodeDistance(point,
-      &node), 0.25, 1e-5);
+      &node), 0.5, 1e-5);
 
   // Now from the other side of the bound.
   point[0] = 1.5;
 
   BOOST_REQUIRE_CLOSE(NearestNeighborSort::BestPointToNodeDistance(point,
-      &node), 0.25, 1e-5);
+      &node), 0.5, 1e-5);
 
   // And now when the point is inside the bound.
   point[0] = 0.5;
 
-  BOOST_REQUIRE_CLOSE(NearestNeighborSort::BestPointToNodeDistance(point,
-      &node), 0.0, 1e-5);
+  BOOST_REQUIRE_SMALL(NearestNeighborSort::BestPointToNodeDistance(point,
+      &node), 1e-5);
 }
 
 // Tests for FurthestNeighborSort
@@ -264,9 +264,9 @@
   utility[0] = 6;
   nodeTwo.Bound() |= utility;
 
-  // This should use the L2 squared distance.
+  // This should use the L2 distance.
   BOOST_REQUIRE_CLOSE(FurthestNeighborSort::BestNodeToNodeDistance(&nodeOne,
-      &nodeTwo), 36.0, 1e-5);
+      &nodeTwo), 6.0, 1e-5);
 
   // And another just to be sure, from the other side.
   nodeTwo.Bound().Clear();
@@ -275,9 +275,9 @@
   utility[0] = -1;
   nodeTwo.Bound() |= utility;
 
-  // Again, the distance is the L2 squared distance.
+  // Again, the distance is the L2 distance.
   BOOST_REQUIRE_CLOSE(FurthestNeighborSort::BestNodeToNodeDistance(&nodeOne,
-      &nodeTwo), 9.0, 1e-5);
+      &nodeTwo), 3.0, 1e-5);
 
   // Now, when the bounds overlap.
   nodeTwo.Bound().Clear();
@@ -287,7 +287,7 @@
   nodeTwo.Bound() |= utility;
 
   BOOST_REQUIRE_CLOSE(FurthestNeighborSort::BestNodeToNodeDistance(&nodeOne,
-      &nodeTwo), (1.5 * 1.5), 1e-5);
+      &nodeTwo), 1.5, 1e-5);
 }
 
 /**
@@ -310,21 +310,21 @@
   arma::vec point(1);
   point[0] = -0.5;
 
-  // The distance is the L2 squared distance.
+  // The distance is the L2 distance.
   BOOST_REQUIRE_CLOSE(FurthestNeighborSort::BestPointToNodeDistance(point,
-      &node), (1.5 * 1.5), 1e-5);
+      &node), 1.5, 1e-5);
 
   // Now from the other side of the bound.
   point[0] = 1.5;
 
   BOOST_REQUIRE_CLOSE(FurthestNeighborSort::BestPointToNodeDistance(point,
-      &node), (1.5 * 1.5), 1e-5);
+      &node), 1.5, 1e-5);
 
   // And now when the point is inside the bound.
   point[0] = 0.5;
 
   BOOST_REQUIRE_CLOSE(FurthestNeighborSort::BestPointToNodeDistance(point,
-      &node), 0.25, 1e-5);
+      &node), 0.5, 1e-5);
 }
 
 BOOST_AUTO_TEST_SUITE_END();

Modified: mlpack/trunk/src/mlpack/tests/tree_test.cpp
===================================================================
--- mlpack/trunk/src/mlpack/tests/tree_test.cpp	2013-02-22 23:14:36 UTC (rev 14374)
+++ mlpack/trunk/src/mlpack/tests/tree_test.cpp	2013-02-22 23:15:20 UTC (rev 14375)
@@ -149,8 +149,8 @@
 
   arma::vec point = "-2.0 0.0 10.0 3.0 3.0";
 
-  // This will be the Euclidean squared distance.
-  BOOST_REQUIRE_CLOSE(b.MinDistance(point), 95.0, 1e-5);
+  // This will be the Euclidean distance.
+  BOOST_REQUIRE_CLOSE(b.MinDistance(point), sqrt(95.0), 1e-5);
 
   point = "2.0 5.0 2.0 -5.0 1.0";
 
@@ -189,8 +189,8 @@
   c[3] = Range(2.0, 5.0);
   c[4] = Range(3.0, 4.0);
 
-  BOOST_REQUIRE_CLOSE(b.MinDistance(c), 22.0, 1e-5);
-  BOOST_REQUIRE_CLOSE(c.MinDistance(b), 22.0, 1e-5);
+  BOOST_REQUIRE_CLOSE(b.MinDistance(c), sqrt(22.0), 1e-5);
+  BOOST_REQUIRE_CLOSE(c.MinDistance(b), sqrt(22.0), 1e-5);
 
   // The other bound is on the edge of the bound.
   c[0] = Range(-2.0, 0.0);
@@ -252,16 +252,16 @@
 
   arma::vec point = "-2.0 0.0 10.0 3.0 3.0";
 
-  // This will be the Euclidean squared distance.
-  BOOST_REQUIRE_CLOSE(b.MaxDistance(point), 253.0, 1e-5);
+  // This will be the Euclidean distance.
+  BOOST_REQUIRE_CLOSE(b.MaxDistance(point), sqrt(253.0), 1e-5);
 
   point = "2.0 5.0 2.0 -5.0 1.0";
 
-  BOOST_REQUIRE_CLOSE(b.MaxDistance(point), 46.0, 1e-5);
+  BOOST_REQUIRE_CLOSE(b.MaxDistance(point), sqrt(46.0), 1e-5);
 
   point = "1.0 2.0 0.0 -2.0 1.5";
 
-  BOOST_REQUIRE_CLOSE(b.MaxDistance(point), 23.25, 1e-5);
+  BOOST_REQUIRE_CLOSE(b.MaxDistance(point), sqrt(23.25), 1e-5);
 }
 
 /**
@@ -292,8 +292,8 @@
   c[3] = Range(2.0, 5.0);
   c[4] = Range(3.0, 4.0);
 
-  BOOST_REQUIRE_CLOSE(b.MaxDistance(c), 210.0, 1e-5);
-  BOOST_REQUIRE_CLOSE(c.MaxDistance(b), 210.0, 1e-5);
+  BOOST_REQUIRE_CLOSE(b.MaxDistance(c), sqrt(210.0), 1e-5);
+  BOOST_REQUIRE_CLOSE(c.MaxDistance(b), sqrt(210.0), 1e-5);
 
   // The other bound is on the edge of the bound.
   c[0] = Range(-2.0, 0.0);
@@ -302,8 +302,8 @@
   c[3] = Range(-10.0, -5.0);
   c[4] = Range(2.0, 3.0);
 
-  BOOST_REQUIRE_CLOSE(b.MaxDistance(c), 134.0, 1e-5);
-  BOOST_REQUIRE_CLOSE(c.MaxDistance(b), 134.0, 1e-5);
+  BOOST_REQUIRE_CLOSE(b.MaxDistance(c), sqrt(134.0), 1e-5);
+  BOOST_REQUIRE_CLOSE(c.MaxDistance(b), sqrt(134.0), 1e-5);
 
   // The other bound partially overlaps the bound.
   c[0] = Range(-2.0, 1.0);
@@ -312,12 +312,12 @@
   c[3] = Range(-8.0, -4.0);
   c[4] = Range(0.0, 4.0);
 
-  BOOST_REQUIRE_CLOSE(b.MaxDistance(c), 102.0, 1e-5);
-  BOOST_REQUIRE_CLOSE(c.MaxDistance(b), 102.0, 1e-5);
+  BOOST_REQUIRE_CLOSE(b.MaxDistance(c), sqrt(102.0), 1e-5);
+  BOOST_REQUIRE_CLOSE(c.MaxDistance(b), sqrt(102.0), 1e-5);
 
   // The other bound fully overlaps the bound.
-  BOOST_REQUIRE_CLOSE(b.MaxDistance(b), 46.0, 1e-5);
-  BOOST_REQUIRE_CLOSE(c.MaxDistance(c), 61.0, 1e-5);
+  BOOST_REQUIRE_CLOSE(b.MaxDistance(b), sqrt(46.0), 1e-5);
+  BOOST_REQUIRE_CLOSE(c.MaxDistance(c), sqrt(61.0), 1e-5);
 
   // The other bound is entirely inside the bound / the other bound entirely
   // envelops the bound.
@@ -327,13 +327,13 @@
   c[3] = Range(-7.0, 0.0);
   c[4] = Range(0.0, 5.0);
 
-  BOOST_REQUIRE_CLOSE(b.MaxDistance(c), 100.0, 1e-5);
-  BOOST_REQUIRE_CLOSE(c.MaxDistance(b), 100.0, 1e-5);
+  BOOST_REQUIRE_CLOSE(b.MaxDistance(c), sqrt(100.0), 1e-5);
+  BOOST_REQUIRE_CLOSE(c.MaxDistance(b), sqrt(100.0), 1e-5);
 
   // Identical bounds.  This will be the sum of the squared widths in each
   // dimension.
-  BOOST_REQUIRE_CLOSE(b.MaxDistance(b), 46.0, 1e-5);
-  BOOST_REQUIRE_CLOSE(c.MaxDistance(c), 162.0, 1e-5);
+  BOOST_REQUIRE_CLOSE(b.MaxDistance(b), sqrt(46.0), 1e-5);
+  BOOST_REQUIRE_CLOSE(c.MaxDistance(c), sqrt(162.0), 1e-5);
 
   // One last additional case.  If the bound encloses only one point, the
   // maximum distance between it and itself is 0.
@@ -1528,7 +1528,7 @@
 
   // Both points are contained in the one node.
   BinarySpaceTree<HRectBound<2> > twoPoint(dataset);
-  BOOST_REQUIRE_CLOSE(twoPoint.FurthestDescendantDistance(), 2.0, 1e-5);
+  BOOST_REQUIRE_CLOSE(twoPoint.FurthestDescendantDistance(), sqrt(2.0), 1e-5);
 }
 
 // Forward declaration of methods we need for the next test.




More information about the mlpack-svn mailing list