def correspond(Z, Y):
 is_valid_linkage(Z, throw=True)
 distance.is_valid_y(Y, throw=True)
 Z = np.asarray(Z, order='c')
 Y = np.asarray(Y, order='c')
 return (distance.num_obs_y(Y) == num_obs_linkage(Z))

def correspond ( Z , Y ) : is_valid_linkage ( Z , throw = True ) distance . is_valid_y ( Y , throw = True ) Z = np . asarray ( Z , order = 'c' ) Y = np . asarray ( Y , order = 'c' ) return ( distance . num_obs_y ( Y ) == num_obs_linkage ( Z ) )
checks for correspondence between linkage and condensed distance matrices they must have the same number of original observations for the check to succeed .