Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

hierarchy.linkage raises an ugly exception for a compressed 2x2 distance matrix #3403

Closed
argriffing opened this Issue · 0 comments

3 participants

argriffing Ralf Gommers Pauli Virtanen
argriffing
Collaborator
>>> scipy.cluster.hierarchy.linkage([1], method='single', metric='cityblock')
Traceback (most recent call last):
/scipy/cluster/hierarchy.py", line 655, in linkage
    return Z
UnboundLocalError: local variable 'Z' referenced before assignment

A reason is that the conversion-to-double of a 1d array with 1 element is returning something other than a 1d numpy array.

>>> scipy.cluster.hierarchy._convert_to_double(np.asarray([1], order='c'))
1.0

Another reason is that the if/elif is assumed to cover all cases.

Pauli Virtanen pv closed this in #3405
Pauli Virtanen pv added this to the 0.15.0 milestone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.