Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:dgarcia:python312:numeric
python-fastcluster
support-numpy-2.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File support-numpy-2.patch of Package python-fastcluster
From 58cffa97fff38ca4dda3166b4ccb1a8eb27a124f Mon Sep 17 00:00:00 2001 From: Steve Kowalik <steven@wedontsleep.org> Date: Fri, 19 Jul 2024 12:21:11 +1000 Subject: [PATCH] Support Numpy 2 Switch to using np.asarray() where required to support both Numpy 1 and 2. --- fastcluster.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fastcluster.py b/fastcluster.py index f5325a6..8778605 100644 --- a/fastcluster.py +++ b/fastcluster.py @@ -23,7 +23,7 @@ __version_info__ = ('1', '2', '6') __version__ = '.'.join(__version_info__) -from numpy import double, empty, array, ndarray, var, cov, dot, expand_dims, \ +from numpy import double, empty, array, asarray, ndarray, var, cov, dot, expand_dims, \ ceil, sqrt from numpy.linalg import inv try: @@ -227,7 +227,7 @@ def linkage(X, method='single', metric='euclidean', preserve_input=True): The linkage method does not treat NumPy's masked arrays as special and simply ignores the mask.''' - X = array(X, copy=False, subok=True) + X = asarray(X) if X.ndim==1: if method=='single': preserve_input = False @@ -464,10 +464,10 @@ def linkage_vector(X, method='single', metric='euclidean', extraarg=None): dtype = bool if X.dtype==bool else double else: dtype = bool if metric in booleanmetrics else double - X = array(X, dtype=dtype, copy=False, order='C', subok=True) else: assert metric=='euclidean' - X = array(X, dtype=double, copy=(method=='ward'), order='C', subok=True) + dtype = double + X = asarray(X, dtype=dtype, order='C') assert X.ndim==2 N = len(X) Z = empty((N-1,4))
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor