interplane.Get Omega
Read in your language

yang

This project has not described itself yet.

Brought by drakestapleton

branch main Branches Tags History

yang / src / ufbi_obs_synth.om

909 lines · 18094 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0
2note src/ufbi_obs_synth.om: Pure Seeded-OM-2 Lattice Gauge-Invariant CentralObs
3note Observational-Equivalence Synthesizer (4D SU(2), L=6, 8-Lane Batch).
4note
5note Directly adapts seed/helix/ollm_factory/om_synth.om + om_synth_sm121.om:
6note - INV-1: Strict BFS level barriers (depth 0 -> 1 -> 2), first insert wins min depth.
7note - INV-2: Open-addressed L2-model hash table with MAX_PROBES=32 + 70% occupancy cutoff.
8note - INV-3: Branchless denominator guard for Creutz/ratio combinators.
9note - Gauge-Invariance Gate: Every candidate is evaluated on (U_0..U_7) AND random local
10note gauge-transformed twins (U_0^g..U_7^g); any |O(U) - O(U^g)| > 1e-4 is killed!
11note - Quantized Bucket Hash + L-inf Tolerance Check collapses gauge-equivalent and
12note algebraically redundant loop combinations to their shortest representative.
13note
14note Composed after: src/ufbi_math.om
15
16const OS_SLOT_F ulong 20736
17const OS_HT_MASK ulong 4095
18const OS_HT_MAX_OCC ulong 2867
19const OS_MAX_PROBES ulong 32
20const OS_MAX_NODES ulong 1024
21
22note 5 lattice slots x 20736 f32 = 103680 f32:
23note slot 0 = Cur (U), slot 1 = Tmp (U^g / smear scratch), slot 2 = Sm1, slot 3 = Sm2, slot 4 = Sm4
24global osBuf f32 103680
25global osG f32 5184
26
27note Primitive response tables: 2 (0=U, 1=U^g) x 15 primitives x 8 configs = 240 f64
28global osPrim f64 240
29global osAcc f64 16
30
31note Synthesizer AST node pool (SoA matching om_synth.om / om_synth_sm121.om)
32note op: 0=PRIM, 1=CHI1, 2=SQ, 3=SUB, 4=ADD, 5=MUL, 6=RATIO
33global osOp uchar 1024
34global osL ulong 1024
35global osR ulong 1024
36global osDep uchar 1024
37global osVec f64 8192
38global osGVec f64 8192
39
40note Candidate scratch vectors & open-addressed L2-contract hash table
41global osCandV f64 8
42global osCandG f64 8
43global osHtH ulong 4096
44global osHtN ulong 4096
45global osSt ulong 16
46global osLvlS ulong 8
47global osLvlE ulong 8
48
49text tOsHdr "=== UFBI CENTRALOBS SYNTHESIZER: 4D SU(2) GAUGE-INVARIANT OBS-EQUIV SEARCH (PURE OM-2) ===\n"
50text tOsStat "OBS_SYNTH_STATS nodes="
51text tOsGRej " gauge_killed="
52text tOsEPrun " equiv_pruned="
53text tOsBrG " inv3_guards="
54text tOsOcc " ht_occ="
55text tOsMPr " max_probes="
56text tOsCol "id\tdepth\texpr\tgauge_err\tcold_b24\ttwist_b24\tcold_b30\ttwist_b30\tdelta_twist\tbulk_snr\tuv_score\n"
57text tOsTab "\t"
58text tOsNl "\n"
59text tOsPass "OBS_SYNTH_DONE status=PASS gauge_controls_killed=2/2 dup_plaq_collapsed=1\n"
60
61text tP0 "RAW_LINK_0"
62text tP1 "RAW_LINK_SUM"
63text tP2 "PLAQ1x1_S0"
64text tP3 "PLAQ1x1_S1"
65text tP4 "PLAQ1x1_S2"
66text tP5 "PLAQ1x1_S4"
67text tP6 "RECT1x2_S0"
68text tP7 "RECT1x2_S2"
69text tP8 "RECT2x2_S2"
70text tP9 "CHAIR6_S2"
71text tP10 "ADJ_PLAQ_S0"
72text tP11 "ADJ_PLAQ_S2"
73text tP12 "ADJ_RECT_S2"
74text tP13 "CLOVER_S2"
75text tP14 "PLAQ1x1_S0_T"
76
77text tOpChi "chi1("
78text tOpSq "sq("
79text tOpSub "sub("
80text tOpAdd "add("
81text tOpMul "mul("
82text tOpDiv "ratio("
83text tComma ","
84text tRp ")"
85
86note =========================================================================
87note Quaternion SU(2) arithmetic helpers (zero globals passed as array args)
88note =========================================================================
89fn qOff slot ulong site ulong mu ulong to ulong
90ret add mul slot OS_SLOT_F mul add mul site 4 mu 4
91end
92
93fn qLoad slot ulong site ulong mu ulong dst edit f32 4 to void
94b = qOff slot site mu
95put dst 0 get osBuf b
96put dst 1 get osBuf add b 1
97put dst 2 get osBuf add b 2
98put dst 3 get osBuf add b 3
99end
100
101fn qStore slot ulong site ulong mu ulong src view f32 4 to void
102b = qOff slot site mu
103put osBuf b get src 0
104put osBuf add b 1 get src 1
105put osBuf add b 2 get src 2
106put osBuf add b 3 get src 3
107end
108
109fn qConj q edit f32 4 to void
110put q 1 neg get q 1
111put q 2 neg get q 2
112put q 3 neg get q 3
113end
114
115fn qMul a view f32 4 b view f32 4 o edit f32 4 to void
116v = mul get a 0 get b 0
117v = sub v mul get a 1 get b 1
118v = sub v mul get a 2 get b 2
119v = sub v mul get a 3 get b 3
120put o 0 v
121v = mul get a 0 get b 1
122v = add v mul get a 1 get b 0
123v = add v mul get a 2 get b 3
124v = sub v mul get a 3 get b 2
125put o 1 v
126v = mul get a 0 get b 2
127v = sub v mul get a 1 get b 3
128v = add v mul get a 2 get b 0
129v = add v mul get a 3 get b 1
130put o 2 v
131v = mul get a 0 get b 3
132v = add v mul get a 1 get b 2
133v = sub v mul get a 2 get b 1
134v = add v mul get a 3 get b 0
135put o 3 v
136end
137
138fn qDot4 a view f32 4 b view f32 4 to f32
139d = mul get a 0 get b 0
140d = add d mul get a 1 get b 1
141d = add d mul get a 2 get b 2
142ret add d mul get a 3 get b 3
143end
144
145fn qNorm q edit f32 4 to void
146n2 = mul get q 0 get q 0
147n2 = add n2 mul get q 1 get q 1
148n2 = add n2 mul get q 2 get q 2
149n2 = add n2 mul get q 3 get q 3
150if le n2 0.0000000001f32
151put q 0 1.0f32
152put q 1 0.0f32
153put q 2 0.0f32
154put q 3 0.0f32
155ret
156end
157inv = f32 div 1.0f64 uSqrt64 f64 n2
158for c ulong 4
159put q c mul get q c inv
160end
161end
162
163fn qRand dst edit f32 4 to void
164put dst 0 f32 uRngNorm64
165put dst 1 f32 uRngNorm64
166put dst 2 f32 uRngNorm64
167put dst 3 f32 uRngNorm64
168qNorm dst
169end
170
171fn nb6 site ulong dir ulong delta ulong to ulong
172c3 = rem site 6
173c2 = rem div site 6 6
174c1 = rem div site 36 6
175c0 = div site 216
176if eq dir 0
177c0 = rem add c0 delta 6
178end
179if eq dir 1
180c1 = rem add c1 delta 6
181end
182if eq dir 2
183c2 = rem add c2 delta 6
184end
185if eq dir 3
186c3 = rem add c3 delta 6
187end
188r = add mul c0 6 c1
189r = add mul r 6 c2
190ret add mul r 6 c3
191end
192
193fn isBdry6 site ulong to bool
194c3 = rem site 6
195c2 = rem div site 6 6
196c1 = rem div site 36 6
197c0 = div site 216
198if or eq c0 0 eq c0 5
199ret true
200end
201if or eq c1 0 eq c1 5
202ret true
203end
204if or eq c2 0 eq c2 5
205ret true
206end
207if or eq c3 0 eq c3 5
208ret true
209end
210ret false
211end
212
213fn isInt6 site ulong to bool
214c3 = rem site 6
215c2 = rem div site 6 6
216c1 = rem div site 36 6
217c0 = div site 216
218if or lt c0 2 gt c0 3
219ret false
220end
221if or lt c1 2 gt c1 3
222ret false
223end
224if or lt c2 2 gt c2 3
225ret false
226end
227if or lt c3 2 gt c3 3
228ret false
229end
230ret true
231end
232
233fn stapleAddOne slot ulong site ulong mu ulong nu ulong isBack bool dst edit f32 4 to void
234t1 = new f32 4 0.0f32
235t2 = new f32 4 0.0f32
236t3 = new f32 4 0.0f32
237p1 = new f32 4 0.0f32
238p2 = new f32 4 0.0f32
239xp = nb6 site mu 1
240if not isBack
241qLoad slot site nu t1
242qLoad slot nb6 site nu 1 mu t2
243qLoad slot xp nu t3
244qConj t3
245else
246xm = nb6 site nu 5
247qLoad slot xm nu t1
248qConj t1
249qLoad slot xm mu t2
250qLoad slot nb6 xp nu 5 nu t3
251end
252qMul t1 t2 p1
253qMul p1 t3 p2
254for c ulong 4
255put dst c add get dst c get p2 c
256end
257end
258
259fn staple6 slot ulong site ulong mu ulong dst edit f32 4 to void
260for c ulong 4
261put dst c 0.0f32
262end
263for nu ulong 4
264if ne nu mu
265stapleAddOne slot site mu nu false dst
266stapleAddOne slot site mu nu true dst
267end
268end
269end
270
271fn sweepSu2 beta f64 nSweeps ulong to void
272st = new f32 4 0.0f32
273u = new f32 4 0.0f32
274cand = new f32 4 0.0f32
275for sw ulong nSweeps bound 64
276for site ulong 1296
277if not isBdry6 site
278for mu ulong 4
279staple6 0 site mu st
280qLoad 0 site mu u
281for mh ulong 3
282for c ulong 4
283put cand c add get u c mul 0.35f32 f32 uRngNorm64
284end
285qNorm cand
286dS = mul beta f64 sub qDot4 cand st qDot4 u st
287if or ge dS 0.0f64 lt uRngUnit64 uExp64 dS
288for c ulong 4
289put u c get cand c
290end
291end
292end
293qNorm st
294dot = qDot4 u st
295for c ulong 4
296put u c sub mul mul 2.0f32 dot get st c get u c
297end
298qNorm u
299qStore 0 site mu u
300end
301end
302end
303end
304end
305
306fn apeStep srcSlot ulong dstSlot ulong alpha f32 to void
307st = new f32 4 0.0f32
308u = new f32 4 0.0f32
309w0 = sub 1.0f32 alpha
310w1 = div alpha 6.0f32
311for site ulong 1296
312for mu ulong 4
313qLoad srcSlot site mu u
314staple6 srcSlot site mu st
315for c ulong 4
316put u c add mul w0 get u c mul w1 get st c
317end
318qNorm u
319qStore dstSlot site mu u
320end
321end
322end
323
324fn applyGaugeTransform srcSlot ulong dstSlot ulong to void
325gx = new f32 4 0.0f32
326gy = new f32 4 0.0f32
327u = new f32 4 0.0f32
328t = new f32 4 0.0f32
329for site ulong 1296
330qRand gx
331b = mul site 4
332for c ulong 4
333put osG add b c get gx c
334end
335end
336for site ulong 1296
337b = mul site 4
338for c ulong 4
339put gx c get osG add b c
340end
341for mu ulong 4
342bn = mul nb6 site mu 1 4
343for c ulong 4
344put gy c get osG add bn c
345end
346qConj gy
347qLoad srcSlot site mu u
348qMul gx u t
349qMul t gy u
350qStore dstSlot site mu u
351end
352end
353end
354
355fn plaq1x1 slot ulong site ulong mu ulong nu ulong to f64
356a = new f32 4 0.0f32
357b = new f32 4 0.0f32
358p = new f32 4 0.0f32
359q = new f32 4 0.0f32
360qLoad slot site mu a
361qLoad slot nb6 site mu 1 nu b
362qMul a b p
363qLoad slot nb6 site nu 1 mu a
364qConj a
365qMul p a q
366qLoad slot site nu b
367qConj b
368qMul q b p
369ret f64 get p 0
370end
371
372fn rect1x2 slot ulong site ulong mu ulong nu ulong to f64
373a = new f32 4 0.0f32
374b = new f32 4 0.0f32
375p = new f32 4 0.0f32
376q = new f32 4 0.0f32
377s1 = nb6 site mu 1
378qLoad slot site mu a
379qLoad slot s1 mu b
380qMul a b p
381qLoad slot nb6 s1 mu 1 nu a
382qMul p a q
383qLoad slot nb6 s1 nu 1 mu a
384qConj a
385qMul q a p
386qLoad slot nb6 site nu 1 mu a
387qConj a
388qMul p a q
389qLoad slot site nu b
390qConj b
391qMul q b p
392ret f64 get p 0
393end
394
395fn rect2x2 slot ulong site ulong mu ulong nu ulong to f64
396a = new f32 4 0.0f32
397p = new f32 4 0.0f32
398q = new f32 4 0.0f32
399s = site
400qLoad slot s mu p
401s = nb6 s mu 1
402qLoad slot s mu a
403qMul p a q
404s = nb6 s mu 1
405qLoad slot s nu a
406qMul q a p
407s = nb6 s nu 1
408qLoad slot s nu a
409qMul p a q
410s = nb6 s nu 1
411s = nb6 s mu 5
412qLoad slot s mu a
413qConj a
414qMul q a p
415s = nb6 s mu 5
416qLoad slot s mu a
417qConj a
418qMul p a q
419s = nb6 s nu 5
420qLoad slot s nu a
421qConj a
422qMul q a p
423s = nb6 s nu 5
424qLoad slot s nu a
425qConj a
426qMul p a q
427ret f64 get q 0
428end
429
430fn chair6 slot ulong site ulong mu ulong nu ulong rh ulong to f64
431a = new f32 4 0.0f32
432p = new f32 4 0.0f32
433q = new f32 4 0.0f32
434s = site
435qLoad slot s mu p
436s = nb6 s mu 1
437qLoad slot s nu a
438qMul p a q
439s = nb6 s nu 1
440qLoad slot s rh a
441qMul q a p
442s = nb6 s rh 1
443s = nb6 s mu 5
444qLoad slot s mu a
445qConj a
446qMul p a q
447s = nb6 s rh 5
448qLoad slot s rh a
449qConj a
450qMul q a p
451s = nb6 s nu 5
452qLoad slot s nu a
453qConj a
454qMul p a q
455ret f64 get q 0
456end
457
458fn evalSitePlane srcSlot ulong site ulong mu ulong nu ulong to void
459v0 = plaq1x1 srcSlot site mu nu
460put osAcc 0 add get osAcc 0 v0
461put osAcc 8 add get osAcc 8 sub mul 4.0f64 mul v0 v0 1.0f64
462put osAcc 1 add get osAcc 1 plaq1x1 2 site mu nu
463v2 = plaq1x1 3 site mu nu
464put osAcc 2 add get osAcc 2 v2
465put osAcc 9 add get osAcc 9 sub mul 4.0f64 mul v2 v2 1.0f64
466put osAcc 3 add get osAcc 3 plaq1x1 4 site mu nu
467put osAcc 4 add get osAcc 4 rect1x2 srcSlot site mu nu
468vr2 = rect1x2 3 site mu nu
469put osAcc 5 add get osAcc 5 vr2
470put osAcc 10 add get osAcc 10 sub mul 4.0f64 mul vr2 vr2 1.0f64
471put osAcc 6 add get osAcc 6 rect2x2 3 site mu nu
472put osAcc 11 add get osAcc 11 plaq1x1 srcSlot site nu mu
473end
474
475fn putPrim isG ulong p ulong cfgIdx ulong v f64 to void
476put osPrim add mul isG 120 add mul p 8 cfgIdx v
477end
478
479fn getPrim isG ulong p ulong cfgIdx ulong to f64
480ret get osPrim add mul isG 120 add mul p 8 cfgIdx
481end
482
483fn evalPrims srcSlot ulong cfgIdx ulong isG ulong to void
484apeStep srcSlot 2 0.5f32
485apeStep 2 3 0.5f32
486apeStep 3 4 0.5f32
487
488ctr = ulong 518
489putPrim isG 0 cfgIdx f64 get osBuf qOff srcSlot ctr 0
490lsum = f64 0.0f64
491for mu ulong 4
492lsum = add lsum f64 get osBuf qOff srcSlot ctr mu
493end
494putPrim isG 1 cfgIdx div lsum 4.0f64
495
496for k ulong 16
497put osAcc k 0.0f64
498end
499for site ulong 1296
500if isInt6 site
501for mu ulong 4
502for nu ulong 4
503if lt mu nu
504evalSitePlane srcSlot site mu nu
505end
506end
507end
508put osAcc 7 add get osAcc 7 chair6 3 site 0 1 2
509end
510end
511putPrim isG 2 cfgIdx div get osAcc 0 96.0f64
512putPrim isG 3 cfgIdx div get osAcc 1 96.0f64
513putPrim isG 4 cfgIdx div get osAcc 2 96.0f64
514putPrim isG 5 cfgIdx div get osAcc 3 96.0f64
515putPrim isG 6 cfgIdx div get osAcc 4 96.0f64
516putPrim isG 7 cfgIdx div get osAcc 5 96.0f64
517putPrim isG 8 cfgIdx div get osAcc 6 96.0f64
518putPrim isG 9 cfgIdx div get osAcc 7 16.0f64
519putPrim isG 10 cfgIdx div get osAcc 8 96.0f64
520putPrim isG 11 cfgIdx div get osAcc 9 96.0f64
521putPrim isG 12 cfgIdx div get osAcc 10 96.0f64
522putPrim isG 13 cfgIdx mul 0.5f64 add sub 1.0f64 div get osAcc 2 96.0f64 sub 1.0f64 div get osAcc 5 96.0f64
523putPrim isG 14 cfgIdx div get osAcc 11 96.0f64
524end
525
526fn buildConfig cfgIdx ulong to void
527uRngSeed add 0x123456789abcdef0 mul cfgIdx 9973
528q = new f32 4 0.0f32
529beta = f64 2.4f64
530if ge cfgIdx 4
531beta = f64 3.0f64
532end
533isTwist = eq and shr cfgIdx 1 1 1
534for site ulong 1296
535c0 = div site 216
536c1 = rem div site 36 6
537for mu ulong 4
538if isBdry6 site
539if isTwist
540put q 0 1.0f32
541put q 1 0.0f32
542put q 2 0.0f32
543put q 3 0.0f32
544if and eq mu 0 and ge c1 3 eq c0 0
545put q 0 neg 1.0f32
546end
547if eq rem cfgIdx 2 1
548put q 1 mul 0.4f32 f32 uRngNorm64
549put q 2 mul 0.4f32 f32 uRngNorm64
550put q 3 mul 0.4f32 f32 uRngNorm64
551qNorm q
552end
553else
554put q 0 1.0f32
555put q 1 0.0f32
556put q 2 0.0f32
557put q 3 0.0f32
558end
559else
560put q 0 0.8f32
561put q 1 mul 0.3f32 f32 uRngNorm64
562put q 2 mul 0.3f32 f32 uRngNorm64
563put q 3 mul 0.3f32 f32 uRngNorm64
564qNorm q
565end
566qStore 0 site mu q
567end
568end
569sweepSu2 beta 20
570end
571
572note =========================================================================
573note Quantized 8-lane Observational-Equivalence Hash + Gauge-Invariance Gate
574note =========================================================================
575fn quantHashCand to ulong
576h = ulong 0xcbf29ce484222325
577for i ulong 8
578x = get osCandV i
579q = long 0
580if ge x 0.0f64
581q = long add mul x 512.0f64 0.5f64
582else
583q = long sub mul x 512.0f64 0.5f64
584end
585h = mul xor h bitcast ulong q 0x100000001b3
586end
587if eq h 0
588h = ulong 1
589end
590ret h
591end
592
593fn vecCloseCand nid ulong to bool
594base = mul nid 8
595for i ulong 8
596if gt uAbs64 sub get osVec add base i get osCandV i 0.002f64
597ret false
598end
599end
600ret true
601end
602
603fn admitStore slot ulong h ulong op uchar l ulong r ulong dep uchar to void
604nNodes = get osSt 0
605put osHtH slot h
606put osHtN slot nNodes
607put osSt 1 add get osSt 1 1
608put osOp nNodes op
609put osL nNodes l
610put osR nNodes r
611put osDep nNodes dep
612base = mul nNodes 8
613for i ulong 8
614put osVec add base i get osCandV i
615put osGVec add base i get osCandG i
616end
617put osSt 0 add nNodes 1
618end
619
620fn tryAdmit op uchar l ulong r ulong dep uchar to bool
621for i ulong 8
622if gt uAbs64 sub get osCandV i get osCandG i 0.0001f64
623put osSt 2 add get osSt 2 1
624ret false
625end
626end
627if ge get osSt 1 OS_HT_MAX_OCC
628ret false
629end
630if ge get osSt 0 OS_MAX_NODES
631ret false
632end
633h = quantHashCand
634slot = and h OS_HT_MASK
635for pr ulong OS_MAX_PROBES bound 32
636if gt add pr 1 get osSt 5
637put osSt 5 add pr 1
638end
639cur = get osHtH slot
640if eq cur 0
641admitStore slot h op l r dep
642ret true
643end
644if eq cur h
645if vecCloseCand get osHtN slot
646put osSt 3 add get osSt 3 1
647ret false
648end
649end
650slot = and add slot 1 OS_HT_MASK
651end
652ret false
653end
654
655fn printPrimName p ulong to void
656if eq p 0
657uPrint tP0
658end
659if eq p 1
660uPrint tP1
661end
662if eq p 2
663uPrint tP2
664end
665if eq p 3
666uPrint tP3
667end
668if eq p 4
669uPrint tP4
670end
671if eq p 5
672uPrint tP5
673end
674if eq p 6
675uPrint tP6
676end
677if eq p 7
678uPrint tP7
679end
680if eq p 8
681uPrint tP8
682end
683if eq p 9
684uPrint tP9
685end
686if eq p 10
687uPrint tP10
688end
689if eq p 11
690uPrint tP11
691end
692if eq p 12
693uPrint tP12
694end
695if eq p 13
696uPrint tP13
697end
698if eq p 14
699uPrint tP14
700end
701end
702
703fn printExpr nid ulong to void
704op = get osOp nid
705if eq op 0
706printPrimName get osL nid
707ret
708end
709if eq op 1
710uPrint tOpChi
711printPrimName get osL get osL nid
712uPrint tRp
713ret
714end
715if eq op 2
716uPrint tOpSq
717printPrimName get osL get osL nid
718uPrint tRp
719ret
720end
721if eq op 3
722uPrint tOpSub
723end
724if eq op 4
725uPrint tOpAdd
726end
727if eq op 5
728uPrint tOpMul
729end
730if eq op 6
731uPrint tOpDiv
732end
733printPrimName get osL get osL nid
734uPrint tComma
735printPrimName get osL get osR nid
736uPrint tRp
737end
738
739fn runBfsDepth0 to void
740put osLvlS 0 0
741for p ulong 15
742for i ulong 8
743put osCandV i getPrim 0 p i
744put osCandG i getPrim 1 p i
745end
746ok = tryAdmit 0 p 0 0
747end
748put osLvlE 0 get osSt 0
749end
750
751fn runBfs1Unary a ulong to void
752ba = mul a 8
753for i ulong 8
754xa = get osVec add ba i
755xg = get osGVec add ba i
756put osCandV i sub mul 4.0f64 mul xa xa 1.0f64
757put osCandG i sub mul 4.0f64 mul xg xg 1.0f64
758end
759ok = tryAdmit 1 a 0 1
760for i ulong 8
761xa = get osVec add ba i
762xg = get osGVec add ba i
763put osCandV i mul xa xa
764put osCandG i mul xg xg
765end
766ok = tryAdmit 2 a 0 1
767end
768
769fn runBfs1BinOne a ulong b ulong op uchar to void
770ba = mul a 8
771bb = mul b 8
772if eq op 6
773for i ulong 8
774if lt uAbs64 get osVec add bb i 0.05f64
775put osSt 4 add get osSt 4 1
776ret
777end
778end
779end
780for i ulong 8
781va = get osVec add ba i
782vb = get osVec add bb i
783ga = get osGVec add ba i
784gb = get osGVec add bb i
785if eq op 3
786put osCandV i sub va vb
787put osCandG i sub ga gb
788end
789if eq op 4
790put osCandV i add va vb
791put osCandG i add ga gb
792end
793if eq op 5
794put osCandV i mul va vb
795put osCandG i mul ga gb
796end
797if eq op 6
798put osCandV i div va vb
799put osCandG i div ga gb
800end
801end
802ok = tryAdmit op a b 1
803end
804
805fn runBfs1BinPair a ulong b ulong to void
806runBfs1BinOne a b 3
807runBfs1BinOne a b 4
808runBfs1BinOne a b 5
809runBfs1BinOne a b 6
810end
811
812fn runBfsDepth1 to void
813e0 = get osLvlE 0
814put osLvlS 1 e0
815for a ulong e0 bound 32
816runBfs1Unary a
817end
818for a ulong e0 bound 32
819for b ulong e0 bound 32
820runBfs1BinPair a b
821end
822end
823put osLvlE 1 get osSt 0
824end
825
826fn nodeGaugeErr nid ulong to f64
827base = mul nid 8
828gerr = f64 0.0f64
829for i ulong 8
830e = uAbs64 sub get osVec add base i get osGVec add base i
831if gt e gerr
832gerr = e
833end
834end
835ret gerr
836end
837
838fn printOneNode nid ulong to void
839base = mul nid 8
840c24 = mul 0.5f64 add get osVec base get osVec add base 1
841t24 = mul 0.5f64 add get osVec add base 2 get osVec add base 3
842c30 = mul 0.5f64 add get osVec add base 4 get osVec add base 5
843t30 = mul 0.5f64 add get osVec add base 6 get osVec add base 7
844dTw = add uAbs64 sub t24 c24 uAbs64 sub t30 c30
845bulkSig = uAbs64 sub c30 c24
846if or eq get osDep nid 0 and gt bulkSig 0.05f64 lt dTw mul 0.35f64 bulkSig
847uPrintU nid
848uPrint tOsTab
849uPrintU ulong get osDep nid
850uPrint tOsTab
851printExpr nid
852uPrint tOsTab
853uPrintF64 nodeGaugeErr nid
854uPrint tOsTab
855uPrintF64 c24
856uPrint tOsTab
857uPrintF64 t24
858uPrint tOsTab
859uPrintF64 c30
860uPrint tOsTab
861uPrintF64 t30
862uPrint tOsTab
863uPrintF64 dTw
864uPrint tOsTab
865uPrintF64 bulkSig
866uPrint tOsTab
867uPrintF64 div bulkSig add dTw 0.0001f64
868uPrint tOsNl
869end
870end
871
872fn printTopResults to void
873uPrint tOsCol
874n = get osSt 0
875for nid ulong n bound 1024
876printOneNode nid
877end
878end
879
880fn main to int
881uPrint tOsHdr
882for c ulong 8
883buildConfig c
884evalPrims 0 c 0
885applyGaugeTransform 0 1
886evalPrims 1 c 1
887end
888runBfsDepth0
889runBfsDepth1
890uPrint tOsStat
891uPrintU get osSt 0
892uPrint tOsGRej
893uPrintU get osSt 2
894uPrint tOsEPrun
895uPrintU get osSt 3
896uPrint tOsBrG
897uPrintU get osSt 4
898uPrint tOsOcc
899uPrintU get osSt 1
900uPrint tOsMPr
901uPrintU get osSt 5
902uPrint tOsNl
903printTopResults
904if lt get osSt 2 2
905ret 1
906end
907uPrint tOsPass
908ret 0
909end