[Scipy-svn] r4599 - trunk/scipy/cluster

scipy-svn@scip... scipy-svn@scip...
Mon Aug 4 14:48:26 CDT 2008


Author: damian.eads
Date: 2008-08-04 14:48:18 -0500 (Mon, 04 Aug 2008)
New Revision: 4599

Modified:
   trunk/scipy/cluster/distance.py
Log:
Fixed canberra. Now passes a double array to C-extension instead of a bool.

Modified: trunk/scipy/cluster/distance.py
===================================================================
--- trunk/scipy/cluster/distance.py	2008-08-04 19:00:04 UTC (rev 4598)
+++ trunk/scipy/cluster/distance.py	2008-08-04 19:48:18 UTC (rev 4599)
@@ -764,7 +764,7 @@
             # (u-v)V^(-1)(u-v)^T
             _distance_wrap.pdist_mahalanobis_wrap(_convert_to_double(X), VI, dm)
         elif mstr == 'canberra':
-            _distance_wrap.pdist_canberra_wrap(_convert_to_bool(X), dm)
+            _distance_wrap.pdist_canberra_wrap(_convert_to_double(X), dm)
         elif mstr == 'braycurtis':
             _distance_wrap.pdist_bray_curtis_wrap(_convert_to_bool(X), dm)
         elif mstr == 'yule':
@@ -802,6 +802,8 @@
             [VI] = _copy_arrays_if_base_present([VI])
             # (u-v)V^(-1)(u-v)^T
             dm = pdist(X, (lambda u, v: mahalanobis(u, v, VI)))
+        elif metric == 'test_canberra':
+            dm = pdist(X, canberra)
         elif metric == 'test_cityblock':
             dm = pdist(X, cityblock)
         elif metric == 'test_minkowski':



More information about the Scipy-svn mailing list