# menon16.py -- group-developed Hadamard matrices of order 16: for each of the 14 groups G of order 16 (groups16.py), # all the functions f : G -> {-1,1} with (f(gh)) Hadamard, that is, the Menon difference sets with parameters # (16,6,2) or (16,10,6). Such a matrix has constant row sums, hence equivalent to had16.0, had16.1 or had16.2, which are told # apart by the 2-rank of the core of the dephased matrix, equal to 4, 5, 6 respectively (realglowrank.py). import numpy as np, itertools from collections import Counter from groups16 import CATALOG 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 cls={4:"had16.0",5:"had16.1",6:"had16.2"} total=Counter() for name,G in CATALOG.items(): n=len(G); e=next(k for k,g in enumerate(G) if g==tuple(range(n))) # G[k] is the left regular permutation of element k: G[k][h] = index of k*h mult=np.array([[G[a][b] for b in range(n)] for a in range(n)]) found=Counter(); count=0 for D in itertools.combinations(range(n),6): f=np.ones(n,int); f[list(D)]=-1 M=f[mult] if (M@M.T==n*np.eye(n,dtype=int)).all(): count+=1 D2=M*M[:,[0]]; D2=D2*D2[[0],:] found[cls[rank2(((1-D2)//2).astype(np.int64))]]+=1 print(f"{name:12s} difference sets of size 6: {count:4d} classes: {dict(sorted(found.items()))}") for k in found: total[(k,name)]+=1 print() for c in ["had16.0","had16.1","had16.2"]: print(c,"is group-developed over",sorted(g for (k,g) in total if k==c))