# For each BH(8,8) matrix K (exponents of zeta_8), search b in mu_8^8 (b_0=1) with |Kb|^2=8 on all rows, # and row-sum ratios in mu_8 (so that D_1 K D_2 is a bistochastic BH(8,8)). import numpy as np, itertools, sys L=[l.strip() for l in open('bh88.txt') if l.strip()] z=np.exp(2j*np.pi/8) B=np.array(list(itertools.product(range(8),repeat=7))); Bv=np.hstack([np.ones((len(B),1)),z**B]) res=[] for t,l in enumerate(L): E=np.array([int(c) for c in l[6:]]).reshape(8,8); K=z**E assert np.allclose(K@K.conj().T,8*np.eye(8)),t S=Bv@K.T ok=np.all(np.abs(np.abs(S)**2-8)<1e-9,axis=1) good=0 for i in np.nonzero(ok)[0]: r=np.angle(S[i]/S[i,0])/(2*np.pi)*8 if np.allclose(r,np.round(r),atol=1e-7): good+=1 res.append((t+1,int(ok.sum()),good)) print(f"BH(8,8) #{t+1:3d}: {ok.sum():6d} flat column vectors, {good:6d} with row phases in mu_8",flush=True) none=[r[0] for r in res if r[2]==0] print("classes with NO bistochastic form over mu_8:",len(none),none)