# fourierside.py -- the Bjorck-Froberg matrix BF_6 on the Fourier side (Proposition 5.22). Exact arithmetic in K=Q(i,a), with # a^4=2a^3+2a-1, the elements being written in the basis i^e a^f. We compute the eigenvalues lambda_k of BF_6, check that # |lambda_k|^2=6 and that the norms of the lambda_k have 2-adic and 3-adic valuation 4, half that of 6, and compute the # phase function Phi(k,l,m)=lambda_k conj(lambda_l) conj(lambda_m) lambda_{l+m-k}/36 modulo the primes above 2 and 3. # At both primes b=a+1 is a uniformizer, with Eisenstein equation b^4-6b^3+12b^2-12b+6=0, the residue field being F_4, # generated by w=(-1+sqrt(-3))/2, at 2, and F_9, generated by i, at 3. Output: Phi=1 modulo the prime above 2, and # Phi=(-1)^((k-l)(k-m)) modulo the prime above 3, together with the first order valuations of the differences. # Usage: python3 fourierside.py # Bjorck-Froberg matrix BF_6: exact arithmetic in Q(a,i), a^4=2a^3+2a-1, and the conditions C1, C2 from fractions import Fraction as Fr import itertools, math, numpy as np from collections import Counter def mul(x,y): r=[Fr(0)]*8 for e1 in range(2): for f1 in range(4): c1=x[4*e1+f1] if not c1: continue for e2 in range(2): for f2 in range(4): c2=y[4*e2+f2] if not c2: continue e=e1+e2; s=1 if e==2: e=0; s=-1 poly=[Fr(0)]*7; poly[f1+f2]=c1*c2*s for k in range(6,3,-1): if poly[k]: c=poly[k]; poly[k]=0; poly[k-1]+=2*c; poly[k-3]+=2*c; poly[k-4]-=c for k in range(4): r[4*e+k]+=poly[k] return r def add(x,y): return [u+v for u,v in zip(x,y)] def el(e,f,c=1): v=[Fr(0)]*8; v[4*e+f]=Fr(c); return v I=el(1,0); A=el(0,1); ONE=el(0,0) ABAR=add(add(el(0,3,-1),el(0,2,2)),el(0,0,2)) def conj(x): # i -> -i, a -> abar r=[Fr(0)]*8; pw=[ONE] for k in range(3): pw.append(mul(pw[-1],ABAR)) for e in range(2): for f in range(4): c=x[4*e+f] if c: t=[c*u for u in pw[f]] if e==1: t=mul(t,[-u for u in I]) r=add(r,t) return r def neg(x): return [-u for u in x] assert mul(A,ABAR)==ONE ia=mul(I,A); iab=mul(I,ABAR) row=[ONE,ia,neg(A),neg(I),neg(ABAR),iab] H=[[row[(j-i)%6] for j in range(6)] for i in range(6)] def el(e,f,c=1): v=[Fr(0)]*8; v[4*e+f]=Fr(c); return v def norm(x): cols=[mul(x,el(e,f)) for e in range(2) for f in range(4)] M=[[cols[j][i] for j in range(8)] for i in range(8)] n=8; det=Fr(1) for k in range(n): piv=next((i for i in range(k,n) if M[i][k]!=0),None) if piv is None: return Fr(0) if piv!=k: M[k],M[piv]=M[piv],M[k]; det=-det det*=M[k][k] for i in range(k+1,n): f=M[i][k]/M[k][k] for j in range(k,n): M[i][j]-=f*M[k][j] return det def vp(n,p): v=0 while n%p==0: n//=p; v+=1 return v s3n=np.sqrt(3); an=(1-s3n+1j*np.sqrt(2*s3n))/2 def cval(x): return sum(float(x[4*e+f])*(1j**e)*an**f for e in range(2) for f in range(4)) Hn=np.array([[cval(x) for x in r] for r in H]) print("BF_6 Hadamard (numerically): %.1e"%abs(Hn@Hn.conj().T-6*np.eye(6)).max()) from collections import Counter from fractions import Fraction as Fr s3=add(add(ONE,neg(A)),neg(ABAR)) w6=[x/2 for x in add(ONE,mul(I,s3))] def pw(x,k): r=ONE for _ in range(k): r=mul(r,x) return r lam=[] for k in range(6): t=[Fr(0)]*8 for s in range(6): t=add(t,mul(row[s],pw(w6,(k*s)%6))) lam.append(t) for k in range(6): nk=norm(lam[k]) print("lambda_%d: |lambda|^2=6: %s, valuations of the norm at 2 and 3: %d, %d"%(k,mul(lam[k],conj(lam[k]))==[Fr(6)]+[Fr(0)]*7,vp(nk.numerator,2),vp(nk.numerator,3))) # Q(a)-part helpers: polynomial in a of degree<4 -> polynomial in b=a+1 of degree <4, reduced by b^4=6b^3-12b^2+12b-6 from math import comb def a_to_b(p): # p: coefficients of a^0..a^3 r=[Fr(0)]*8 for f,c in enumerate(p): if c: for j in range(f+1): r[j]+=c*comb(f,j)*(-1)**(f-j) # a^f=(b-1)^f # reduce degree (here max 3) - nothing to do return r[:4] def qa_mul(p,q): x=[p[0],p[1],p[2],p[3],0,0,0,0]; y=[q[0],q[1],q[2],q[3],0,0,0,0] z=mul([Fr(c) for c in x],[Fr(c) for c in y]); return z[:4] def qa_inv(p): # invert in Q(a) via linear algebra on multiplication matrix cols=[qa_mul(p,[1 if j==i else 0 for j in range(4)]) for i in range(4)] M=[[cols[j][i] for j in range(4)]+[Fr(1 if i==0 else 0)] for i in range(4)] for c in range(4): piv=next(r for r in range(c,4) if M[r][c]!=0); M[c],M[piv]=M[piv],M[c] pv=M[c][c]; M[c]=[x/pv for x in M[c]] for r in range(4): if r!=c and M[r][c]!=0: fac=M[r][c]; M[r]=[x-fac*y for x,y in zip(M[r],M[c])] return [M[i][4] for i in range(4)] s3a=s3[:4]; is3=qa_inv(s3a) def red3(x): # x = x0 + x1 i, x0,x1 in Q(a); at P above 3: basis i^e b^f, residue = (x0(b=0), x1(b=0)) mod 3 in F_9 out=[] for part in (x[:4],x[4:]): cb=a_to_b(part) if any(c.denominator%3==0 for c in cb): return None out.append(int(cb[0].numerator*pow(cb[0].denominator,-1,3))%3) return tuple(out) def red2(x): # x = x0 + x1 i, i=(2 omega+1)/sqrt3: y0 = x0 + x1/sqrt3, y1 = 2 x1/sqrt3; residue in F_4 = (y0(b=0), y1(b=0)) mod 2 x0=x[:4]; x1=x[4:] t=qa_mul(x1,is3); y0=[p+q for p,q in zip(x0,t)]; y1=[2*q for q in t] out=[] for part in (y0,y1): cb=a_to_b(part) if any(c.denominator%2==0 for c in cb): return None out.append(int(cb[0].numerator*pow(cb[0].denominator,-1,2))%2) return tuple(out) def Phi(k,l,m): n=(l+m-k)%6 t=mul(mul(lam[k],conj(lam[l])),mul(conj(lam[m]),lam[n])) return [c/36 for c in t] for name,red in (("p=3",red3),("p=2",red2)): cnt=Counter(); table={} for k,l,m in itertools.product(range(6),repeat=3): r=red(Phi(k,l,m)); cnt[r]+=1; table[(k,l,m)]=r print(name,"residues of Phi:",dict(cnt)) if name=="p=3": T3=table else: T2=table # look for structure: does Phi mod P depend on (k-l)(k-m) mod something? for name,T in (("p=3",T3),("p=2",T2)): st=Counter() for (k,l,m),r in T.items(): st[((k-l)*(k-m)%6,r)]+=1 print(name,"by (k-l)(k-m) mod 6:",sorted(st.items(),key=str)) def vb(x,p): # valuation in the uniformizer b (e=4), and leading coefficient residue if p==2: x0=x[:4]; x1=x[4:]; t=qa_mul(x1,is3); parts=[[p_+q for p_,q in zip(x0,t)],[2*q for q in t]] else: parts=[x[:4],x[4:]] best=None for f in range(4): cs=[a_to_b(part)[f] for part in parts] for c in cs: if c!=0: v=0; n,d=c.numerator,c.denominator while n%p==0: n//=p; v+=1 while d%p==0: d//=p; v-=1 val=4*v+f if best is None or val