def assess_same_labelling(cut1, cut2):
 co_clust = []
 for cut in [cut1, cut2]:
  n = len(cut)
  k = (cut.max() + 1)
  ecut = np.zeros((n, k))
  ecut[(np.arange(n), cut)] = 1
  co_clust.append(np.dot(ecut, ecut.T))
 assert_true((co_clust[0] == co_clust[1]).all())

def assess_same_labelling ( cut1 , cut2 ) : co_clust = [ ] for cut in [ cut1 , cut2 ] : n = len ( cut ) k = ( cut . max ( ) + 1 ) ecut = np . zeros ( ( n , k ) ) ecut [ ( np . arange ( n ) , cut ) ] = 1 co_clust . append ( np . dot ( ecut , ecut . T ) ) assert_true ( ( co_clust [ 0 ] == co_clust [ 1 ] ) . all ( ) )
util for comparison with scipy .