# cocyclic16.py -- centrally regular subgroups of the symmetry group of a real Hadamard matrix of order 8 or 16 # (usage: cocyclic16.py matrix.txt aut.npy R.npy, the file aut.npy coming from autgroup.py). # A subgroup R of Aut(H), of order 2N, containing z=(-1,-1), is centrally regular when R/ acts regularly on the # rows and on the columns, up to sign: these R correspond to the cocyclic developments of H, over G=R/. # The cocycle is trivial over T precisely when z is not in [R,R]. R being a 2-group, it lies in a Sylow 2-subgroup, # so we search inside one Sylow 2-subgroup S, of order 4096, which up to conjugacy covers all cases. import numpy as np, sys, time from collections import Counter t0=time.time() H=np.loadtxt(sys.argv[1] if len(sys.argv)>1 else 'had163.txt').astype(int); N=len(H) Qs=np.load(sys.argv[2] if len(sys.argv)>2 else 'aut.npy'); M=len(Qs) print(f"|Aut| = {M}, N = {N}",flush=True) # signed permutations on 2N points: point j is +e_j, point j+N is -e_j; Q e_j = s e_c c=np.argmax(np.abs(Qs),axis=1) # c[k,j] = image column of j s=np.take_along_axis(Qs,c[:,None,:],axis=1)[:,0,:] # s[k,j] = sign P32=np.zeros((M,2*N),np.int16) P32[:,:N]=c+N*(s<0); P32[:,N:]=c+N*(s>0) idx={P32[k].tobytes():k for k in range(M)} assert len(idx)==M ident=np.arange(2*N,dtype=np.int16); zz=np.concatenate([np.arange(N,2*N),np.arange(N)]).astype(np.int16) def mul(g,h): return g[h] # (g h)(x) = g(h(x)) def inv(g): r=np.empty_like(g); r[g]=np.arange(len(g),dtype=g.dtype); return r def closure(gens,limit=10**6): G={ident.tobytes():ident}; frontier=[ident] while frontier: new=[] for x in frontier: for g in gens: y=mul(g,x); k=y.tobytes() if k not in G: G[k]=y; new.append(y) if len(G)>limit: return None frontier=new return G # ---- a Sylow 2-subgroup, grown one step at a time: if S is a 2-subgroup which is not Sylow, N(S)/S has even order inv_all=np.empty_like(P32); rows=np.arange(M)[:,None]; inv_all[rows,P32]=np.arange(2*N,dtype=np.int16)[None,:] def normalizer(Sgens,Sset): ok=np.ones(M,bool) for g in Sgens: conj=np.take_along_axis(P32,np.take_along_axis(np.broadcast_to(g,(M,2*N)),inv_all.astype(np.int64),1).astype(np.int64),1) # x g x^-1 ok&=np.array([conj[k].tobytes() in Sset for k in range(M)]) return np.nonzero(ok)[0] Sgens=[zz]; S=closure(Sgens) target=1 while M%(2*target)==0: target*=2 while len(S)N: return None frontier=new return frozenset(G) C={j:[g for g in Sbar if g[0]==j] for j in range(N)} seen=set(); regular=set() def explore(K): if K in seen: return seen.add(K) orbit={x[0] for x in K} if len(orbit)==N: regular.add(K); return j=min(set(range(N))-orbit) for g in C[j]: L=sclosure(K,g) if L is not None: explore(L) explore(frozenset([pid])) print(f"regular subgroups of the image of S: {len(regular)} ({time.time()-t0:.0f}s)",flush=True) from groups16 import name as name16, invariant from groups import NAMES def name(G): if len(G)==16: return name16(G) e=tuple(range(len(G[0]))) def order(x): k=1; y=x while y!=e: y=pmul(x,y); k+=1 return k return NAMES[len(G)].get(tuple(sorted(Counter(order(x) for x in G).items())),str(invariant(G))) # ---- lift to R, test the rows, test z in [R,R] Hf=H.astype(float) def rowperm(g): Q=np.zeros((N,N),int) for j in range(N): cc=int(g[j]); Q[cc%N,j]=1 if cc3 else 'cocyclic16_R.npy',np.array([np.array(R) for v in examples.values() for R in v])) print('centrally regular subgroups saved:',{k:len(v) for k,v in examples.items()})