import numpy as np, itertools, sys sys.path.insert(0,'/home/claude/jw/jw') import matrices as M def col_pairings(rho, tol=1e-8): """all perfect matchings of columns with rho[c'] = -rho[c]""" n=len(rho); out=[] def rec(rem, acc): if not rem: out.append(frozenset(acc)); return c=rem[0] for d in rem[1:]: if abs(rho[c]+rho[d])