"""Degree and finite-weight gradings of the E7 fifth-node coordinates.""" import numpy as np from seed import seed,DS,EDGES,WORD from constants import PREFIX from exchange import cartan def weights(): B,vs,d=seed();C=cartan('E',7)[0];I=np.eye(7,dtype=np.int64);L=I.copy() for i1 in PREFIX: i=i1-1;S=I.copy();S[:,i]-=C[:,i];L=L@S assert np.array_equal(L@L,I) children=[[] for _ in DS] for i,j in EDGES:children[i].append(j) def sub(i):return [i]+sum((sub(j) for j in children[i]),[]) W=[];cham={};w=I.copy() for k,i1 in enumerate(WORD,1): i=i1-1;S=I.copy();S[:,i]-=C[:,i];w=w@S;cham[f'X{k}']=L@(I[:,i]-w[:,i]) for v,dm in zip(vs,d): xi=-dm*I[:,6] if isinstance(v,tuple): charge=np.zeros(7,dtype=np.int64) if v[0] in ['s','t']: _,i,m=v;charge[i]=m for j in sub(i): if j!=i:charge[j]=DS[j] elif v[0]=='edge': for j in sub(v[2]):charge[j]=DS[j] elif v[0]=='frame':charge=np.array(DS) xi=xi+L@C@charge elif v.startswith('X'):xi=xi+cham[v] W.append(np.r_[dm,xi]) W=np.array(W) bad=np.argwhere(B[:68]@W) if len(bad):print('BAD',[(vs[i],int(j),int((B[:68]@W)[i,j])) for i,j in bad[:20]]) assert not len(bad) return B,vs,W