def _check_is_partition(locs, n):
 if (len(locs) != n):
  return False
 hit = np.zeros(n, bool)
 hit[locs] = True
 if (not np.all(hit)):
  return False
 return True

def _check_is_partition ( locs , n ) : if ( len ( locs ) != n ) : return False hit = np . zeros ( n , bool ) hit [ locs ] = True if ( not np . all ( hit ) ) : return False return True
check whether locs is a reordering of the array np .