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

scipy-svn at scipy.org scipy-svn at scipy.org
Tue Jun 3 03:48:56 EDT 2008


Author: damian.eads
Date: 2008-06-03 02:48:54 -0500 (Tue, 03 Jun 2008)
New Revision: 4407

Modified:
   trunk/scipy/cluster/hierarchy.py
Log:
Convert non-double arrays to double so that hierarchy functions can be called with more input types.

Modified: trunk/scipy/cluster/hierarchy.py
===================================================================
--- trunk/scipy/cluster/hierarchy.py	2008-06-03 07:35:10 UTC (rev 4406)
+++ trunk/scipy/cluster/hierarchy.py	2008-06-03 07:48:54 UTC (rev 4407)
@@ -452,7 +452,7 @@
     if not isinstance(method, str):
         raise TypeError("Argument 'method' must be a string.")
 
-    y = np.asarray(y)
+    y = np.asarray(_convert_to_double(y))
 
     s = y.shape
     if len(s) == 1:
@@ -723,7 +723,7 @@
     transformation.
     """
 
-    X = np.asarray(X)
+    X = _convert_to_double(np.asarray(X))
 
     if not np.issubsctype(X, np.double):
         raise TypeError('A double array must be passed.')
@@ -1612,7 +1612,7 @@
     zz = np.zeros((n*(n-1)/2,), dtype=np.double)
     # Since the C code does not support striding using strides.
     # The dimensions are used instead.
-    [Z] = _copy_arrays_if_base_present([Z])
+    Z = _convert_to_double(Z)
 
     _hierarchy_wrap.cophenetic_distances_wrap(Z, zz, int(n))
     if nargs == 1:




More information about the Scipy-svn mailing list