# subfactor.py -- the Jones transfer matrices of the real Hadamard matrices in the folder matrices. For H of order N we # form the vectors xi_ab = H_a o H_b / sqrt(N), the magic unitary P_ab = Proj(xi_ab), and the matrices # (T_k)_{i1..ik, j1..jk} = tr(P_{i1j1} ... P_{ikjk}), with tr the normalized trace of M_N. We compute dim P_2 and dim P_3, # as the multiplicities of the eigenvalue 1 of T_2 and T_3, the connected components of the profile graph, whose sizes # give the traces of the minimal projections of P_2, also for the transpose, the spectrum of T_2, the traces Tr(T_2^m), # and we check that Tr(T_2^2) = N^-6 S_K44(H), and that Tr(T_2^2) = 7 + 9 * 2^(4-r) at N = 16, with r the 2-rank of the # core of H. We also do the exact versions: N^3 T_2 is an integer matrix, giving Tr(T_2^2), Tr(T_2^3) as fractions, and # for N <= 16 the integer matrix N^4 (T_3 - 1) = A A^t - N^4, with A_{i,x} = prod_s H_{i_s x_s} H_{i_{s+1} x_s}, splits # along the components of its support into blocks with zero row sums, each having nullity at least 1, and exactly 1 when # a principal minor of size one less is nonzero, which we check modulo the prime 10007, so dim P_3 is the number of blocks. import numpy as np, glob from fractions import Fraction from collections import Counter from scipy.sparse.csgraph import connected_components def rank2(A): A=A.copy()%2; r=0; rows,cols=A.shape for c in range(cols): piv=[i for i in range(r,rows) if A[i,c]] if not piv: continue A[[r,piv[0]]]=A[[piv[0],r]] for i in range(rows): if i!=r and A[i,c]: A[i]^=A[r] r+=1 return r def rank_mod(M,l): M=M.copy()%l; r=0; rows,cols=M.shape for c in range(cols): nz=np.nonzero(M[r:,c])[0] if len(nz)==0: continue piv=r+nz[0]; M[[r,piv]]=M[[piv,r]] M[r]=M[r]*pow(int(M[r,c]),-1,l)%l below=r+1+np.nonzero(M[r+1:,c])[0] M[below]=(M[below]-np.outer(M[below,c],M[r]))%l r+=1 if r==rows: break return r def exact_dim_P3(H): N=len(H); W=np.indices((N,N,N)).reshape(3,-1).T A=np.ones((N**3,N**3)) for s in range(3): A*=H[W[:,s][:,None],W[:,s][None,:]]*H[W[:,(s+1)%3][:,None],W[:,s][None,:]] M=np.rint(A@A.T).astype(np.int64)-N**4*np.eye(N**3,dtype=np.int64) assert not M.sum(axis=1).any() nb,lab=connected_components(M!=0,directed=False); sizes=[] for b in range(nb): idx=np.nonzero(lab==b)[0]; sizes.append(len(idx)) if len(idx)>1: assert rank_mod(M[np.ix_(idx[:-1],idx[:-1])],10007)==len(idx)-1 return nb,sorted(sizes,reverse=True) for f in sorted(glob.glob('matrices/had*.txt')): name=f.split('/')[-1][:-4]; H=np.loadtxt(f); N=len(H) D=H*H[:,[0]]; D=D*D[[0],:]; r=rank2(((1-D)//2)[1:,1:].astype(np.int64)) X=(H[:,None,:]*H[None,:,:]).reshape(N*N,N)/np.sqrt(N); G=X@X.T T2=G**2/N; w=np.linalg.eigvalsh(T2); c2=int(np.sum(w>1-1e-8)) ncomp,lab=connected_components(np.abs(G)>1e-8,directed=False); sizes=sorted(np.bincount(lab),reverse=True) S44=np.sum((N*G)**4) vals,counts=np.unique(np.round(w,6),return_counts=True) spec=", ".join(f"{v:g}^{c}" for v,c in zip(vals[::-1],counts[::-1]) if v>1e-6) Gr=G.reshape(N,N,N,N) T3=np.einsum('aAbB,bBcC,cCaA->abcABC',Gr,Gr,Gr,optimize=True).reshape(N**3,N**3)/N c3=int(np.sum(np.linalg.eigvalsh(T3)>1-1e-7)); del T3 Hi=np.rint(H).astype(np.int64); Y=(Hi[:,None,:]*Hi[None,:,:]).reshape(N*N,N); M=(Y@Y.T)**2 t2=Fraction(int(np.sum(M*M.T)),N**6); t3=Fraction(int(np.sum((M@M)*M.T)),N**9) Yt=(Hi.T[:,None,:]*Hi.T[None,:,:]).reshape(N*N,N); nt,lt=connected_components(Yt@Yt.T!=0,directed=False) exact=f" exact: Tr(T2^2) = {t2}, Tr(T2^3) = {t3}, component sizes for the transpose {sorted(np.bincount(lt).tolist(),reverse=True)}" if N<=16: n3,s3=exact_dim_P3(Hi); cs=sorted(Counter(s3).items(),reverse=True) exact+=", dim P3 = %d exactly, block sizes "%n3+" ".join(f"{s}^{c}" if c>1 else f"{s}" for s,c in cs) print(f"{name}: N={N} r={r} dim P2={c2} dim P3={c3} components={ncomp} sizes={[int(s) for s in sizes]}") print(f" Tr(T2^m), m=2..6: "+" ".join(f"{np.sum(w**m):.6f}" for m in range(2,7))+f" N^-6 S_K44 = {S44/N**6:.6f}" +(f" 7+9*2^(4-r) = {7+9*2.0**(4-r):.6f}" if N==16 else "")) print(f" spectrum of T2: {spec[:300]}") print(exact,flush=True)