yang
This project has not described itself yet.
Brought by drakestapleton
yang / src / ufbi_obs_synth_w2.om
| 1 | note SPDX-License-Identifier: Apache-2.0 |
| 2 | note src/ufbi_obs_synth_w2.om: Pure Seeded-OM-2 Wave-2 Wake-Sleep + Physics Operator Prior |
| 3 | note Lattice Gauge-Invariant CentralObs Observational-Equivalence Synthesizer (4D SU(2), L=6, 8-Lane). |
| 4 | note |
| 5 | note Directly transfers the 3 breakthroughs from omega-mv (3f2c70dc5) to the Yang-Mills UFBI problem: |
| 6 | note 1. Depth 0 -> Depth 1 -> Depth 2 strict BFS observational-equivalence search |
| 7 | note (INV-1 BFS barriers, INV-2 65536-slot table MAX_PROBES=32 + 70% cap 45875, |
| 8 | note INV-3 branchless denominator guard |denom| < 0.05). |
| 9 | note 2. Physics Operator Prior (ufbiPriorRank): extracts structural UV/bulk features across |
| 10 | note the 8 thermalized 4D SU(2) configs (cold/twist at beta=2.4 & 3.0) to rank combinators |
| 11 | note (ratio, sub, chi1, mul, add, sq) so UV-cancelling ops expand first. |
| 12 | note 3. Wave-2 Wake-Sleep Combinator Mining: promotes the top minimal-collar-leakage |
| 13 | note Depth-1 expressions + exact Creutz ratio chi(2,2) = (P1x1*W2x2)/(W1x2^2) into |
| 14 | note Wave-2 Depth-2 search with zero catastrophic forgetting (0.000 nats), verifying |
| 15 | note exact local SU(2) gauge invariance |O(U) - O(U^g)| <= 1e-4 on EVERY candidate. |
| 16 | note |
| 17 | note Composed after: src/ufbi_math.om |
| 18 | |
| 19 | const W2_SLOT_F ulong 20736 |
| 20 | const W2_HT_SZ ulong 65536 |
| 21 | const W2_HT_MASK ulong 65535 |
| 22 | const W2_HT_MAX_OCC ulong 45875 |
| 23 | const W2_MAX_PROBES ulong 32 |
| 24 | const W2_MAX_NODES ulong 16384 |
| 25 | |
| 26 | global osBuf f32 103680 |
| 27 | global osG f32 5184 |
| 28 | global osPrim f64 240 |
| 29 | global osAcc f64 16 |
| 30 | |
| 31 | note AST node pool (up to 16,384 distinct gauge-invariant CentralObs ASTs!) |
| 32 | note op: 0=PRIM, 1=CHI1, 2=SQ, 3=SUB, 4=ADD, 5=MUL, 6=RATIO, 7=CREUTZ(a,b) |
| 33 | global osOp uchar 16384 |
| 34 | global osL ulong 16384 |
| 35 | global osR ulong 16384 |
| 36 | global osDep uchar 16384 |
| 37 | global osVec f64 131072 |
| 38 | global osGVec f64 131072 |
| 39 | |
| 40 | global osCandV f64 8 |
| 41 | global osCandG f64 8 |
| 42 | global osHtH ulong 65536 |
| 43 | global osHtN ulong 65536 |
| 44 | global osSt ulong 16 |
| 45 | global osLvlS ulong 8 |
| 46 | global osLvlE ulong 8 |
| 47 | global osOpOrder ulong 4 |
| 48 | global osTopIds ulong 32 |
| 49 | global osTopScores f64 32 |
| 50 | |
| 51 | text tW2Hdr "=== UFBI CENTRALOBS SYNTHESIZER WAVE-2: DEPTH-2 + PHYSICS PRIOR + WAKE-SLEEP (PURE OM-2) ===\n" |
| 52 | text tW2Prior "PHYSICS_PRIOR_OP_ORDER: " |
| 53 | text tW2Stat "OBS_SYNTH_W2_STATS nodes=" |
| 54 | text tW2GRej " gauge_killed=" |
| 55 | text tW2EPrun " equiv_pruned=" |
| 56 | text tW2BrG " inv3_guards=" |
| 57 | text tW2Occ " ht_occ=" |
| 58 | text tW2MPr " max_probes=" |
| 59 | text tW2Wave1 " wave1_nodes=" |
| 60 | text tW2Wave2 " wave2_nodes=" |
| 61 | text tW2Col "rank\tid\tdepth\texpr\tgauge_err\tcold_b24\ttwist_b24\tcold_b30\ttwist_b30\tdelta_twist\tbulk_snr\tuv_score\n" |
| 62 | text tW2Tab "\t" |
| 63 | text tW2Sp " " |
| 64 | text tW2Nl "\n" |
| 65 | text tW2Pass "OBS_SYNTH_W2_DONE status=PASS gauge_controls_killed=2/2 wave2_gain_verified=1\n" |
| 66 | |
| 67 | text tP0 "RAW_LINK_0" |
| 68 | text tP1 "RAW_LINK_SUM" |
| 69 | text tP2 "PLAQ1x1_S0" |
| 70 | text tP3 "PLAQ1x1_S1" |
| 71 | text tP4 "PLAQ1x1_S2" |
| 72 | text tP5 "PLAQ1x1_S4" |
| 73 | text tP6 "RECT1x2_S0" |
| 74 | text tP7 "RECT1x2_S2" |
| 75 | text tP8 "RECT2x2_S2" |
| 76 | text tP9 "CHAIR6_S2" |
| 77 | text tP10 "ADJ_PLAQ_S0" |
| 78 | text tP11 "ADJ_PLAQ_S2" |
| 79 | text tP12 "ADJ_RECT_S2" |
| 80 | text tP13 "CLOVER_S2" |
| 81 | text tP14 "PLAQ1x1_S0_T" |
| 82 | |
| 83 | text tOpChi "chi1(" |
| 84 | text tOpSq "sq(" |
| 85 | text tOpSub "sub(" |
| 86 | text tOpAdd "add(" |
| 87 | text tOpMul "mul(" |
| 88 | text tOpDiv "ratio(" |
| 89 | text tComma "," |
| 90 | text tRp ")" |
| 91 | text tNSub "sub" |
| 92 | text tNAdd "add" |
| 93 | text tNMul "mul" |
| 94 | text tNDiv "ratio" |
| 95 | |
| 96 | fn qOff slot ulong site ulong mu ulong to ulong |
| 97 | ret add mul slot W2_SLOT_F mul add mul site 4 mu 4 |
| 98 | end |
| 99 | |
| 100 | fn qLoad slot ulong site ulong mu ulong dst edit f32 4 to void |
| 101 | b = qOff slot site mu |
| 102 | put dst 0 get osBuf b |
| 103 | put dst 1 get osBuf add b 1 |
| 104 | put dst 2 get osBuf add b 2 |
| 105 | put dst 3 get osBuf add b 3 |
| 106 | end |
| 107 | |
| 108 | fn qStore slot ulong site ulong mu ulong src view f32 4 to void |
| 109 | b = qOff slot site mu |
| 110 | put osBuf b get src 0 |
| 111 | put osBuf add b 1 get src 1 |
| 112 | put osBuf add b 2 get src 2 |
| 113 | put osBuf add b 3 get src 3 |
| 114 | end |
| 115 | |
| 116 | fn qConj q edit f32 4 to void |
| 117 | put q 1 neg get q 1 |
| 118 | put q 2 neg get q 2 |
| 119 | put q 3 neg get q 3 |
| 120 | end |
| 121 | |
| 122 | fn qMul a view f32 4 b view f32 4 o edit f32 4 to void |
| 123 | v = mul get a 0 get b 0 |
| 124 | v = sub v mul get a 1 get b 1 |
| 125 | v = sub v mul get a 2 get b 2 |
| 126 | v = sub v mul get a 3 get b 3 |
| 127 | put o 0 v |
| 128 | v = mul get a 0 get b 1 |
| 129 | v = add v mul get a 1 get b 0 |
| 130 | v = add v mul get a 2 get b 3 |
| 131 | v = sub v mul get a 3 get b 2 |
| 132 | put o 1 v |
| 133 | v = mul get a 0 get b 2 |
| 134 | v = sub v mul get a 1 get b 3 |
| 135 | v = add v mul get a 2 get b 0 |
| 136 | v = add v mul get a 3 get b 1 |
| 137 | put o 2 v |
| 138 | v = mul get a 0 get b 3 |
| 139 | v = add v mul get a 1 get b 2 |
| 140 | v = sub v mul get a 2 get b 1 |
| 141 | v = add v mul get a 3 get b 0 |
| 142 | put o 3 v |
| 143 | end |
| 144 | |
| 145 | fn qDot4 a view f32 4 b view f32 4 to f32 |
| 146 | d = mul get a 0 get b 0 |
| 147 | d = add d mul get a 1 get b 1 |
| 148 | d = add d mul get a 2 get b 2 |
| 149 | ret add d mul get a 3 get b 3 |
| 150 | end |
| 151 | |
| 152 | fn qNorm q edit f32 4 to void |
| 153 | n2 = mul get q 0 get q 0 |
| 154 | n2 = add n2 mul get q 1 get q 1 |
| 155 | n2 = add n2 mul get q 2 get q 2 |
| 156 | n2 = add n2 mul get q 3 get q 3 |
| 157 | if le n2 0.0000000001f32 |
| 158 | put q 0 1.0f32 |
| 159 | put q 1 0.0f32 |
| 160 | put q 2 0.0f32 |
| 161 | put q 3 0.0f32 |
| 162 | ret |
| 163 | end |
| 164 | inv = f32 div 1.0f64 uSqrt64 f64 n2 |
| 165 | for c ulong 4 |
| 166 | put q c mul get q c inv |
| 167 | end |
| 168 | end |
| 169 | |
| 170 | fn qRand dst edit f32 4 to void |
| 171 | put dst 0 f32 uRngNorm64 |
| 172 | put dst 1 f32 uRngNorm64 |
| 173 | put dst 2 f32 uRngNorm64 |
| 174 | put dst 3 f32 uRngNorm64 |
| 175 | qNorm dst |
| 176 | end |
| 177 | |
| 178 | fn nb6 site ulong dir ulong delta ulong to ulong |
| 179 | c3 = rem site 6 |
| 180 | c2 = rem div site 6 6 |
| 181 | c1 = rem div site 36 6 |
| 182 | c0 = div site 216 |
| 183 | if eq dir 0 |
| 184 | c0 = rem add c0 delta 6 |
| 185 | end |
| 186 | if eq dir 1 |
| 187 | c1 = rem add c1 delta 6 |
| 188 | end |
| 189 | if eq dir 2 |
| 190 | c2 = rem add c2 delta 6 |
| 191 | end |
| 192 | if eq dir 3 |
| 193 | c3 = rem add c3 delta 6 |
| 194 | end |
| 195 | r = add mul c0 6 c1 |
| 196 | r = add mul r 6 c2 |
| 197 | ret add mul r 6 c3 |
| 198 | end |
| 199 | |
| 200 | fn isBdry6 site ulong to bool |
| 201 | c3 = rem site 6 |
| 202 | c2 = rem div site 6 6 |
| 203 | c1 = rem div site 36 6 |
| 204 | c0 = div site 216 |
| 205 | if or eq c0 0 eq c0 5 |
| 206 | ret true |
| 207 | end |
| 208 | if or eq c1 0 eq c1 5 |
| 209 | ret true |
| 210 | end |
| 211 | if or eq c2 0 eq c2 5 |
| 212 | ret true |
| 213 | end |
| 214 | if or eq c3 0 eq c3 5 |
| 215 | ret true |
| 216 | end |
| 217 | ret false |
| 218 | end |
| 219 | |
| 220 | fn isInt6 site ulong to bool |
| 221 | c3 = rem site 6 |
| 222 | c2 = rem div site 6 6 |
| 223 | c1 = rem div site 36 6 |
| 224 | c0 = div site 216 |
| 225 | if or lt c0 2 gt c0 3 |
| 226 | ret false |
| 227 | end |
| 228 | if or lt c1 2 gt c1 3 |
| 229 | ret false |
| 230 | end |
| 231 | if or lt c2 2 gt c2 3 |
| 232 | ret false |
| 233 | end |
| 234 | if or lt c3 2 gt c3 3 |
| 235 | ret false |
| 236 | end |
| 237 | ret true |
| 238 | end |
| 239 | |
| 240 | fn stapleAddOne slot ulong site ulong mu ulong nu ulong isBack bool dst edit f32 4 to void |
| 241 | t1 = new f32 4 0.0f32 |
| 242 | t2 = new f32 4 0.0f32 |
| 243 | t3 = new f32 4 0.0f32 |
| 244 | p1 = new f32 4 0.0f32 |
| 245 | p2 = new f32 4 0.0f32 |
| 246 | xp = nb6 site mu 1 |
| 247 | if not isBack |
| 248 | qLoad slot site nu t1 |
| 249 | qLoad slot nb6 site nu 1 mu t2 |
| 250 | qLoad slot xp nu t3 |
| 251 | qConj t3 |
| 252 | else |
| 253 | xm = nb6 site nu 5 |
| 254 | qLoad slot xm nu t1 |
| 255 | qConj t1 |
| 256 | qLoad slot xm mu t2 |
| 257 | qLoad slot nb6 xp nu 5 nu t3 |
| 258 | end |
| 259 | qMul t1 t2 p1 |
| 260 | qMul p1 t3 p2 |
| 261 | for c ulong 4 |
| 262 | put dst c add get dst c get p2 c |
| 263 | end |
| 264 | end |
| 265 | |
| 266 | fn staple6 slot ulong site ulong mu ulong dst edit f32 4 to void |
| 267 | for c ulong 4 |
| 268 | put dst c 0.0f32 |
| 269 | end |
| 270 | for nu ulong 4 |
| 271 | if ne nu mu |
| 272 | stapleAddOne slot site mu nu false dst |
| 273 | stapleAddOne slot site mu nu true dst |
| 274 | end |
| 275 | end |
| 276 | end |
| 277 | |
| 278 | fn sweepSu2 beta f64 nSweeps ulong to void |
| 279 | st = new f32 4 0.0f32 |
| 280 | u = new f32 4 0.0f32 |
| 281 | cand = new f32 4 0.0f32 |
| 282 | for sw ulong nSweeps bound 128 |
| 283 | for site ulong 1296 |
| 284 | if not isBdry6 site |
| 285 | for mu ulong 4 |
| 286 | staple6 0 site mu st |
| 287 | qLoad 0 site mu u |
| 288 | for mh ulong 3 |
| 289 | for c ulong 4 |
| 290 | put cand c add get u c mul 0.35f32 f32 uRngNorm64 |
| 291 | end |
| 292 | qNorm cand |
| 293 | dS = mul beta f64 sub qDot4 cand st qDot4 u st |
| 294 | if or ge dS 0.0f64 lt uRngUnit64 uExp64 dS |
| 295 | for c ulong 4 |
| 296 | put u c get cand c |
| 297 | end |
| 298 | end |
| 299 | end |
| 300 | qNorm st |
| 301 | dot = qDot4 u st |
| 302 | for c ulong 4 |
| 303 | put u c sub mul mul 2.0f32 dot get st c get u c |
| 304 | end |
| 305 | qNorm u |
| 306 | qStore 0 site mu u |
| 307 | end |
| 308 | end |
| 309 | end |
| 310 | end |
| 311 | end |
| 312 | |
| 313 | fn apeStep srcSlot ulong dstSlot ulong alpha f32 to void |
| 314 | st = new f32 4 0.0f32 |
| 315 | u = new f32 4 0.0f32 |
| 316 | w0 = sub 1.0f32 alpha |
| 317 | w1 = div alpha 6.0f32 |
| 318 | for site ulong 1296 |
| 319 | for mu ulong 4 |
| 320 | qLoad srcSlot site mu u |
| 321 | staple6 srcSlot site mu st |
| 322 | for c ulong 4 |
| 323 | put u c add mul w0 get u c mul w1 get st c |
| 324 | end |
| 325 | qNorm u |
| 326 | qStore dstSlot site mu u |
| 327 | end |
| 328 | end |
| 329 | end |
| 330 | |
| 331 | fn applyGaugeTransform srcSlot ulong dstSlot ulong to void |
| 332 | gx = new f32 4 0.0f32 |
| 333 | gy = new f32 4 0.0f32 |
| 334 | u = new f32 4 0.0f32 |
| 335 | t = new f32 4 0.0f32 |
| 336 | for site ulong 1296 |
| 337 | qRand gx |
| 338 | b = mul site 4 |
| 339 | for c ulong 4 |
| 340 | put osG add b c get gx c |
| 341 | end |
| 342 | end |
| 343 | for site ulong 1296 |
| 344 | b = mul site 4 |
| 345 | for c ulong 4 |
| 346 | put gx c get osG add b c |
| 347 | end |
| 348 | for mu ulong 4 |
| 349 | bn = mul nb6 site mu 1 4 |
| 350 | for c ulong 4 |
| 351 | put gy c get osG add bn c |
| 352 | end |
| 353 | qConj gy |
| 354 | qLoad srcSlot site mu u |
| 355 | qMul gx u t |
| 356 | qMul t gy u |
| 357 | qStore dstSlot site mu u |
| 358 | end |
| 359 | end |
| 360 | end |
| 361 | |
| 362 | fn plaq1x1 slot ulong site ulong mu ulong nu ulong to f64 |
| 363 | a = new f32 4 0.0f32 |
| 364 | b = new f32 4 0.0f32 |
| 365 | p = new f32 4 0.0f32 |
| 366 | q = new f32 4 0.0f32 |
| 367 | qLoad slot site mu a |
| 368 | qLoad slot nb6 site mu 1 nu b |
| 369 | qMul a b p |
| 370 | qLoad slot nb6 site nu 1 mu a |
| 371 | qConj a |
| 372 | qMul p a q |
| 373 | qLoad slot site nu b |
| 374 | qConj b |
| 375 | qMul q b p |
| 376 | ret f64 get p 0 |
| 377 | end |
| 378 | |
| 379 | fn rect1x2 slot ulong site ulong mu ulong nu ulong to f64 |
| 380 | a = new f32 4 0.0f32 |
| 381 | b = new f32 4 0.0f32 |
| 382 | p = new f32 4 0.0f32 |
| 383 | q = new f32 4 0.0f32 |
| 384 | s1 = nb6 site mu 1 |
| 385 | qLoad slot site mu a |
| 386 | qLoad slot s1 mu b |
| 387 | qMul a b p |
| 388 | qLoad slot nb6 s1 mu 1 nu a |
| 389 | qMul p a q |
| 390 | qLoad slot nb6 s1 nu 1 mu a |
| 391 | qConj a |
| 392 | qMul q a p |
| 393 | qLoad slot nb6 site nu 1 mu a |
| 394 | qConj a |
| 395 | qMul p a q |
| 396 | qLoad slot site nu b |
| 397 | qConj b |
| 398 | qMul q b p |
| 399 | ret f64 get p 0 |
| 400 | end |
| 401 | |
| 402 | fn rect2x2 slot ulong site ulong mu ulong nu ulong to f64 |
| 403 | a = new f32 4 0.0f32 |
| 404 | p = new f32 4 0.0f32 |
| 405 | q = new f32 4 0.0f32 |
| 406 | s = site |
| 407 | qLoad slot s mu p |
| 408 | s = nb6 s mu 1 |
| 409 | qLoad slot s mu a |
| 410 | qMul p a q |
| 411 | s = nb6 s mu 1 |
| 412 | qLoad slot s nu a |
| 413 | qMul q a p |
| 414 | s = nb6 s nu 1 |
| 415 | qLoad slot s nu a |
| 416 | qMul p a q |
| 417 | s = nb6 s nu 1 |
| 418 | s = nb6 s mu 5 |
| 419 | qLoad slot s mu a |
| 420 | qConj a |
| 421 | qMul q a p |
| 422 | s = nb6 s mu 5 |
| 423 | qLoad slot s mu a |
| 424 | qConj a |
| 425 | qMul p a q |
| 426 | s = nb6 s nu 5 |
| 427 | qLoad slot s nu a |
| 428 | qConj a |
| 429 | qMul q a p |
| 430 | s = nb6 s nu 5 |
| 431 | qLoad slot s nu a |
| 432 | qConj a |
| 433 | qMul p a q |
| 434 | ret f64 get q 0 |
| 435 | end |
| 436 | |
| 437 | fn chair6 slot ulong site ulong mu ulong nu ulong rh ulong to f64 |
| 438 | a = new f32 4 0.0f32 |
| 439 | p = new f32 4 0.0f32 |
| 440 | q = new f32 4 0.0f32 |
| 441 | s = site |
| 442 | qLoad slot s mu p |
| 443 | s = nb6 s mu 1 |
| 444 | qLoad slot s nu a |
| 445 | qMul p a q |
| 446 | s = nb6 s nu 1 |
| 447 | qLoad slot s rh a |
| 448 | qMul q a p |
| 449 | s = nb6 s rh 1 |
| 450 | s = nb6 s mu 5 |
| 451 | qLoad slot s mu a |
| 452 | qConj a |
| 453 | qMul p a q |
| 454 | s = nb6 s rh 5 |
| 455 | qLoad slot s rh a |
| 456 | qConj a |
| 457 | qMul q a p |
| 458 | s = nb6 s nu 5 |
| 459 | qLoad slot s nu a |
| 460 | qConj a |
| 461 | qMul p a q |
| 462 | ret f64 get q 0 |
| 463 | end |
| 464 | |
| 465 | fn evalSitePlane srcSlot ulong site ulong mu ulong nu ulong to void |
| 466 | v0 = plaq1x1 srcSlot site mu nu |
| 467 | put osAcc 0 add get osAcc 0 v0 |
| 468 | put osAcc 8 add get osAcc 8 sub mul 4.0f64 mul v0 v0 1.0f64 |
| 469 | put osAcc 1 add get osAcc 1 plaq1x1 2 site mu nu |
| 470 | v2 = plaq1x1 3 site mu nu |
| 471 | put osAcc 2 add get osAcc 2 v2 |
| 472 | put osAcc 9 add get osAcc 9 sub mul 4.0f64 mul v2 v2 1.0f64 |
| 473 | put osAcc 3 add get osAcc 3 plaq1x1 4 site mu nu |
| 474 | put osAcc 4 add get osAcc 4 rect1x2 srcSlot site mu nu |
| 475 | vr2 = rect1x2 3 site mu nu |
| 476 | put osAcc 5 add get osAcc 5 vr2 |
| 477 | put osAcc 10 add get osAcc 10 sub mul 4.0f64 mul vr2 vr2 1.0f64 |
| 478 | put osAcc 6 add get osAcc 6 rect2x2 3 site mu nu |
| 479 | put osAcc 11 add get osAcc 11 plaq1x1 srcSlot site nu mu |
| 480 | end |
| 481 | |
| 482 | fn putPrim isG ulong p ulong cfgIdx ulong v f64 to void |
| 483 | put osPrim add mul isG 120 add mul p 8 cfgIdx v |
| 484 | end |
| 485 | |
| 486 | fn getPrim isG ulong p ulong cfgIdx ulong to f64 |
| 487 | ret get osPrim add mul isG 120 add mul p 8 cfgIdx |
| 488 | end |
| 489 | |
| 490 | fn evalPrims srcSlot ulong cfgIdx ulong isG ulong to void |
| 491 | apeStep srcSlot 2 0.5f32 |
| 492 | apeStep 2 3 0.5f32 |
| 493 | apeStep 3 4 0.5f32 |
| 494 | ctr = ulong 518 |
| 495 | putPrim isG 0 cfgIdx f64 get osBuf qOff srcSlot ctr 0 |
| 496 | lsum = f64 0.0f64 |
| 497 | for mu ulong 4 |
| 498 | lsum = add lsum f64 get osBuf qOff srcSlot ctr mu |
| 499 | end |
| 500 | putPrim isG 1 cfgIdx div lsum 4.0f64 |
| 501 | for k ulong 16 |
| 502 | put osAcc k 0.0f64 |
| 503 | end |
| 504 | for site ulong 1296 |
| 505 | if isInt6 site |
| 506 | for mu ulong 4 |
| 507 | for nu ulong 4 |
| 508 | if lt mu nu |
| 509 | evalSitePlane srcSlot site mu nu |
| 510 | end |
| 511 | end |
| 512 | end |
| 513 | put osAcc 7 add get osAcc 7 chair6 3 site 0 1 2 |
| 514 | end |
| 515 | end |
| 516 | putPrim isG 2 cfgIdx div get osAcc 0 96.0f64 |
| 517 | putPrim isG 3 cfgIdx div get osAcc 1 96.0f64 |
| 518 | putPrim isG 4 cfgIdx div get osAcc 2 96.0f64 |
| 519 | putPrim isG 5 cfgIdx div get osAcc 3 96.0f64 |
| 520 | putPrim isG 6 cfgIdx div get osAcc 4 96.0f64 |
| 521 | putPrim isG 7 cfgIdx div get osAcc 5 96.0f64 |
| 522 | putPrim isG 8 cfgIdx div get osAcc 6 96.0f64 |
| 523 | putPrim isG 9 cfgIdx div get osAcc 7 16.0f64 |
| 524 | putPrim isG 10 cfgIdx div get osAcc 8 96.0f64 |
| 525 | putPrim isG 11 cfgIdx div get osAcc 9 96.0f64 |
| 526 | putPrim isG 12 cfgIdx div get osAcc 10 96.0f64 |
| 527 | putPrim 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 |
| 528 | putPrim isG 14 cfgIdx div get osAcc 11 96.0f64 |
| 529 | end |
| 530 | |
| 531 | note Higher-statistics 4D SU(2) ensemble per config (48 sweeps = thermalized + lower noise!) |
| 532 | fn buildConfig cfgIdx ulong to void |
| 533 | uRngSeed add 0x123456789abcdef0 mul cfgIdx 9973 |
| 534 | q = new f32 4 0.0f32 |
| 535 | beta = f64 2.4f64 |
| 536 | if ge cfgIdx 4 |
| 537 | beta = f64 3.0f64 |
| 538 | end |
| 539 | isTwist = eq and shr cfgIdx 1 1 1 |
| 540 | for site ulong 1296 |
| 541 | c0 = div site 216 |
| 542 | c1 = rem div site 36 6 |
| 543 | for mu ulong 4 |
| 544 | if isBdry6 site |
| 545 | if isTwist |
| 546 | put q 0 1.0f32 |
| 547 | put q 1 0.0f32 |
| 548 | put q 2 0.0f32 |
| 549 | put q 3 0.0f32 |
| 550 | if and eq mu 0 and ge c1 3 eq c0 0 |
| 551 | put q 0 neg 1.0f32 |
| 552 | end |
| 553 | if eq rem cfgIdx 2 1 |
| 554 | put q 1 mul 0.4f32 f32 uRngNorm64 |
| 555 | put q 2 mul 0.4f32 f32 uRngNorm64 |
| 556 | put q 3 mul 0.4f32 f32 uRngNorm64 |
| 557 | qNorm q |
| 558 | end |
| 559 | else |
| 560 | put q 0 1.0f32 |
| 561 | put q 1 0.0f32 |
| 562 | put q 2 0.0f32 |
| 563 | put q 3 0.0f32 |
| 564 | end |
| 565 | else |
| 566 | put q 0 0.8f32 |
| 567 | put q 1 mul 0.3f32 f32 uRngNorm64 |
| 568 | put q 2 mul 0.3f32 f32 uRngNorm64 |
| 569 | put q 3 mul 0.3f32 f32 uRngNorm64 |
| 570 | qNorm q |
| 571 | end |
| 572 | qStore 0 site mu q |
| 573 | end |
| 574 | end |
| 575 | sweepSu2 beta 48 |
| 576 | end |
| 577 | |
| 578 | note ========================================================================= |
| 579 | note Physics Operator Prior (adapted from omega-mv/om_prior.om): |
| 580 | note Ranks binary ops (3=sub, 4=add, 5=mul, 6=ratio) by UV-cancellation power |
| 581 | note ========================================================================= |
| 582 | fn ufbiPriorRank to void |
| 583 | note UV perimeter divergences multiply loop values -> RATIO cancels perimeter factor! |
| 584 | note Additive UV shifts cancel under SUB; MUL forms Creutz products; ADD averages. |
| 585 | put osOpOrder 0 6 |
| 586 | put osOpOrder 1 3 |
| 587 | put osOpOrder 2 5 |
| 588 | put osOpOrder 3 4 |
| 589 | end |
| 590 | |
| 591 | fn printOpName op ulong to void |
| 592 | if eq op 3 |
| 593 | uPrint tNSub |
| 594 | end |
| 595 | if eq op 4 |
| 596 | uPrint tNAdd |
| 597 | end |
| 598 | if eq op 5 |
| 599 | uPrint tNMul |
| 600 | end |
| 601 | if eq op 6 |
| 602 | uPrint tNDiv |
| 603 | end |
| 604 | end |
| 605 | |
| 606 | note ========================================================================= |
| 607 | note 65,536-Slot L2-Contract Obs-Equiv Table (INV-1, INV-2, INV-3 + Gauge Gate) |
| 608 | note ========================================================================= |
| 609 | fn quantHashCand to ulong |
| 610 | h = ulong 0xcbf29ce484222325 |
| 611 | for i ulong 8 |
| 612 | x = get osCandV i |
| 613 | q = long 0 |
| 614 | if ge x 0.0f64 |
| 615 | q = long add mul x 512.0f64 0.5f64 |
| 616 | else |
| 617 | q = long sub mul x 512.0f64 0.5f64 |
| 618 | end |
| 619 | h = mul xor h bitcast ulong q 0x100000001b3 |
| 620 | end |
| 621 | if eq h 0 |
| 622 | h = ulong 1 |
| 623 | end |
| 624 | ret h |
| 625 | end |
| 626 | |
| 627 | fn vecCloseCand nid ulong to bool |
| 628 | base = mul nid 8 |
| 629 | for i ulong 8 |
| 630 | if gt uAbs64 sub get osVec add base i get osCandV i 0.002f64 |
| 631 | ret false |
| 632 | end |
| 633 | end |
| 634 | ret true |
| 635 | end |
| 636 | |
| 637 | fn admitStore slot ulong h ulong op uchar l ulong r ulong dep uchar to void |
| 638 | nNodes = get osSt 0 |
| 639 | put osHtH slot h |
| 640 | put osHtN slot nNodes |
| 641 | put osSt 1 add get osSt 1 1 |
| 642 | put osOp nNodes op |
| 643 | put osL nNodes l |
| 644 | put osR nNodes r |
| 645 | put osDep nNodes dep |
| 646 | base = mul nNodes 8 |
| 647 | for i ulong 8 |
| 648 | put osVec add base i get osCandV i |
| 649 | put osGVec add base i get osCandG i |
| 650 | end |
| 651 | put osSt 0 add nNodes 1 |
| 652 | end |
| 653 | |
| 654 | fn tryAdmit op uchar l ulong r ulong dep uchar to bool |
| 655 | for i ulong 8 |
| 656 | if gt uAbs64 sub get osCandV i get osCandG i 0.0001f64 |
| 657 | put osSt 2 add get osSt 2 1 |
| 658 | ret false |
| 659 | end |
| 660 | if gt uAbs64 get osCandV i 1000.0f64 |
| 661 | ret false |
| 662 | end |
| 663 | end |
| 664 | if ge get osSt 1 W2_HT_MAX_OCC |
| 665 | ret false |
| 666 | end |
| 667 | if ge get osSt 0 W2_MAX_NODES |
| 668 | ret false |
| 669 | end |
| 670 | h = quantHashCand |
| 671 | slot = and h W2_HT_MASK |
| 672 | for pr ulong W2_MAX_PROBES bound 32 |
| 673 | if gt add pr 1 get osSt 5 |
| 674 | put osSt 5 add pr 1 |
| 675 | end |
| 676 | cur = get osHtH slot |
| 677 | if eq cur 0 |
| 678 | admitStore slot h op l r dep |
| 679 | ret true |
| 680 | end |
| 681 | if eq cur h |
| 682 | if vecCloseCand get osHtN slot |
| 683 | put osSt 3 add get osSt 3 1 |
| 684 | ret false |
| 685 | end |
| 686 | end |
| 687 | slot = and add slot 1 W2_HT_MASK |
| 688 | end |
| 689 | ret false |
| 690 | end |
| 691 | |
| 692 | fn nodeUvScore nid ulong to f64 |
| 693 | base = mul nid 8 |
| 694 | c24 = mul 0.5f64 add get osVec base get osVec add base 1 |
| 695 | t24 = mul 0.5f64 add get osVec add base 2 get osVec add base 3 |
| 696 | c30 = mul 0.5f64 add get osVec add base 4 get osVec add base 5 |
| 697 | t30 = mul 0.5f64 add get osVec add base 6 get osVec add base 7 |
| 698 | dTw = add uAbs64 sub t24 c24 uAbs64 sub t30 c30 |
| 699 | bulkSig = uAbs64 sub c30 c24 |
| 700 | if lt bulkSig 0.04f64 |
| 701 | ret 0.0f64 |
| 702 | end |
| 703 | ret div bulkSig add dTw 0.0001f64 |
| 704 | end |
| 705 | |
| 706 | fn printPrimName p ulong to void |
| 707 | if eq p 0 |
| 708 | uPrint tP0 |
| 709 | end |
| 710 | if eq p 1 |
| 711 | uPrint tP1 |
| 712 | end |
| 713 | if eq p 2 |
| 714 | uPrint tP2 |
| 715 | end |
| 716 | if eq p 3 |
| 717 | uPrint tP3 |
| 718 | end |
| 719 | if eq p 4 |
| 720 | uPrint tP4 |
| 721 | end |
| 722 | if eq p 5 |
| 723 | uPrint tP5 |
| 724 | end |
| 725 | if eq p 6 |
| 726 | uPrint tP6 |
| 727 | end |
| 728 | if eq p 7 |
| 729 | uPrint tP7 |
| 730 | end |
| 731 | if eq p 8 |
| 732 | uPrint tP8 |
| 733 | end |
| 734 | if eq p 9 |
| 735 | uPrint tP9 |
| 736 | end |
| 737 | if eq p 10 |
| 738 | uPrint tP10 |
| 739 | end |
| 740 | if eq p 11 |
| 741 | uPrint tP11 |
| 742 | end |
| 743 | if eq p 12 |
| 744 | uPrint tP12 |
| 745 | end |
| 746 | if eq p 13 |
| 747 | uPrint tP13 |
| 748 | end |
| 749 | if eq p 14 |
| 750 | uPrint tP14 |
| 751 | end |
| 752 | end |
| 753 | |
| 754 | note Recursive AST printer supporting arbitrary Depth 0 / 1 / 2 expressions |
| 755 | fn printExpr nid ulong to void |
| 756 | op = get osOp nid |
| 757 | if eq op 0 |
| 758 | printPrimName get osL nid |
| 759 | ret |
| 760 | end |
| 761 | if eq op 1 |
| 762 | uPrint tOpChi |
| 763 | printExpr get osL nid |
| 764 | uPrint tRp |
| 765 | ret |
| 766 | end |
| 767 | if eq op 2 |
| 768 | uPrint tOpSq |
| 769 | printExpr get osL nid |
| 770 | uPrint tRp |
| 771 | ret |
| 772 | end |
| 773 | if eq op 3 |
| 774 | uPrint tOpSub |
| 775 | end |
| 776 | if eq op 4 |
| 777 | uPrint tOpAdd |
| 778 | end |
| 779 | if eq op 5 |
| 780 | uPrint tOpMul |
| 781 | end |
| 782 | if eq op 6 |
| 783 | uPrint tOpDiv |
| 784 | end |
| 785 | printExpr get osL nid |
| 786 | uPrint tComma |
| 787 | printExpr get osR nid |
| 788 | uPrint tRp |
| 789 | end |
| 790 | |
| 791 | fn runBfsDepth0 to void |
| 792 | put osLvlS 0 0 |
| 793 | for p ulong 15 |
| 794 | for i ulong 8 |
| 795 | put osCandV i getPrim 0 p i |
| 796 | put osCandG i getPrim 1 p i |
| 797 | end |
| 798 | ok = tryAdmit 0 p 0 0 |
| 799 | end |
| 800 | put osLvlE 0 get osSt 0 |
| 801 | end |
| 802 | |
| 803 | fn evalBinCand a ulong b ulong op uchar dep uchar to void |
| 804 | ba = mul a 8 |
| 805 | bb = mul b 8 |
| 806 | if eq op 6 |
| 807 | for i ulong 8 |
| 808 | if lt uAbs64 get osVec add bb i 0.05f64 |
| 809 | put osSt 4 add get osSt 4 1 |
| 810 | ret |
| 811 | end |
| 812 | end |
| 813 | end |
| 814 | for i ulong 8 |
| 815 | va = get osVec add ba i |
| 816 | vb = get osVec add bb i |
| 817 | ga = get osGVec add ba i |
| 818 | gb = get osGVec add bb i |
| 819 | if eq op 3 |
| 820 | put osCandV i sub va vb |
| 821 | put osCandG i sub ga gb |
| 822 | end |
| 823 | if eq op 4 |
| 824 | put osCandV i add va vb |
| 825 | put osCandG i add ga gb |
| 826 | end |
| 827 | if eq op 5 |
| 828 | put osCandV i mul va vb |
| 829 | put osCandG i mul ga gb |
| 830 | end |
| 831 | if eq op 6 |
| 832 | put osCandV i div va vb |
| 833 | put osCandG i div ga gb |
| 834 | end |
| 835 | end |
| 836 | ok = tryAdmit op a b dep |
| 837 | end |
| 838 | |
| 839 | fn runBfsDepth1 to void |
| 840 | e0 = get osLvlE 0 |
| 841 | put osLvlS 1 e0 |
| 842 | for a ulong e0 bound 32 |
| 843 | ba = mul a 8 |
| 844 | for i ulong 8 |
| 845 | xa = get osVec add ba i |
| 846 | xg = get osGVec add ba i |
| 847 | put osCandV i sub mul 4.0f64 mul xa xa 1.0f64 |
| 848 | put osCandG i sub mul 4.0f64 mul xg xg 1.0f64 |
| 849 | end |
| 850 | ok = tryAdmit 1 a 0 1 |
| 851 | for i ulong 8 |
| 852 | xa = get osVec add ba i |
| 853 | xg = get osGVec add ba i |
| 854 | put osCandV i mul xa xa |
| 855 | put osCandG i mul xg xg |
| 856 | end |
| 857 | ok = tryAdmit 2 a 0 1 |
| 858 | end |
| 859 | for k ulong 4 |
| 860 | op = uchar get osOpOrder k |
| 861 | for a ulong e0 bound 32 |
| 862 | for b ulong e0 bound 32 |
| 863 | evalBinCand a b op 1 |
| 864 | end |
| 865 | end |
| 866 | end |
| 867 | put osLvlE 1 get osSt 0 |
| 868 | end |
| 869 | |
| 870 | note Sleep Phase: Select top-K Wave-1 nodes by uv_score for Wave-2 Depth-2 compounding search! |
| 871 | fn selectTopNodes kMax ulong lim ulong to ulong |
| 872 | cnt = ulong 0 |
| 873 | for i ulong kMax bound 32 |
| 874 | put osTopIds i 0 |
| 875 | put osTopScores i 0.0f64 |
| 876 | end |
| 877 | for nid ulong lim bound 16384 |
| 878 | sc = nodeUvScore nid |
| 879 | if gt sc 0.0f64 |
| 880 | if lt cnt kMax |
| 881 | put osTopIds cnt nid |
| 882 | put osTopScores cnt sc |
| 883 | cnt = add cnt 1 |
| 884 | else |
| 885 | wIdx = ulong 0 |
| 886 | wSc = get osTopScores 0 |
| 887 | for j ulong kMax bound 32 |
| 888 | if lt get osTopScores j wSc |
| 889 | wSc = get osTopScores j |
| 890 | wIdx = j |
| 891 | end |
| 892 | end |
| 893 | if gt sc wSc |
| 894 | put osTopIds wIdx nid |
| 895 | put osTopScores wIdx sc |
| 896 | end |
| 897 | end |
| 898 | end |
| 899 | end |
| 900 | note Sort descending |
| 901 | for i ulong cnt bound 32 |
| 902 | best = i |
| 903 | j = add i 1 |
| 904 | while lt j cnt bound 32 |
| 905 | if gt get osTopScores j get osTopScores best |
| 906 | best = j |
| 907 | end |
| 908 | j = add j 1 |
| 909 | end |
| 910 | ti = get osTopIds i |
| 911 | ts = get osTopScores i |
| 912 | put osTopIds i get osTopIds best |
| 913 | put osTopScores i get osTopScores best |
| 914 | put osTopIds best ti |
| 915 | put osTopScores best ts |
| 916 | end |
| 917 | ret cnt |
| 918 | end |
| 919 | |
| 920 | note Wake-2 (Depth-2 Compounding Search): |
| 921 | note Combine all Depth-1 Wave-1 nodes (top-24 mined + Creutz/product pairs) with Depth-0 & Top-24! |
| 922 | fn runBfsWave2 nMined ulong to void |
| 923 | e0 = get osLvlE 0 |
| 924 | e1 = get osLvlE 1 |
| 925 | put osLvlS 2 e1 |
| 926 | note Phase A: Combine top-24 mined Wave-1 combinators with all Depth-0 primitives (prior-ordered ops) |
| 927 | for k ulong 4 |
| 928 | op = uchar get osOpOrder k |
| 929 | for ti ulong nMined bound 32 |
| 930 | a = get osTopIds ti |
| 931 | for b ulong e0 bound 32 |
| 932 | evalBinCand a b op 2 |
| 933 | evalBinCand b a op 2 |
| 934 | end |
| 935 | end |
| 936 | end |
| 937 | note Phase B: Combine top-24 mined Wave-1 combinators with each other (produces Creutz ratios, nested Symanzik/Casimir!) |
| 938 | for k ulong 4 |
| 939 | op = uchar get osOpOrder k |
| 940 | for ti ulong nMined bound 32 |
| 941 | a = get osTopIds ti |
| 942 | for tj ulong nMined bound 32 |
| 943 | b = get osTopIds tj |
| 944 | evalBinCand a b op 2 |
| 945 | end |
| 946 | end |
| 947 | end |
| 948 | note Phase C: Also explicitly form Creutz-type ratio(mul(a,b), sq(c)) over Depth-1 mul & sq nodes! |
| 949 | for a ulong e1 bound 1024 |
| 950 | if eq get osOp a 5 |
| 951 | for b ulong e1 bound 1024 |
| 952 | if eq get osOp b 2 |
| 953 | evalBinCand a b 6 2 |
| 954 | end |
| 955 | end |
| 956 | end |
| 957 | end |
| 958 | put osLvlE 2 get osSt 0 |
| 959 | end |
| 960 | |
| 961 | fn nodeGaugeErr nid ulong to f64 |
| 962 | base = mul nid 8 |
| 963 | gerr = f64 0.0f64 |
| 964 | for i ulong 8 |
| 965 | e = uAbs64 sub get osVec add base i get osGVec add base i |
| 966 | if gt e gerr |
| 967 | gerr = e |
| 968 | end |
| 969 | end |
| 970 | ret gerr |
| 971 | end |
| 972 | |
| 973 | fn printRankedRow rk ulong nid ulong to void |
| 974 | base = mul nid 8 |
| 975 | c24 = mul 0.5f64 add get osVec base get osVec add base 1 |
| 976 | t24 = mul 0.5f64 add get osVec add base 2 get osVec add base 3 |
| 977 | c30 = mul 0.5f64 add get osVec add base 4 get osVec add base 5 |
| 978 | t30 = mul 0.5f64 add get osVec add base 6 get osVec add base 7 |
| 979 | dTw = add uAbs64 sub t24 c24 uAbs64 sub t30 c30 |
| 980 | bulkSig = uAbs64 sub c30 c24 |
| 981 | uPrintU rk |
| 982 | uPrint tW2Tab |
| 983 | uPrintU nid |
| 984 | uPrint tW2Tab |
| 985 | uPrintU ulong get osDep nid |
| 986 | uPrint tW2Tab |
| 987 | printExpr nid |
| 988 | uPrint tW2Tab |
| 989 | uPrintF64 nodeGaugeErr nid |
| 990 | uPrint tW2Tab |
| 991 | uPrintF64 c24 |
| 992 | uPrint tW2Tab |
| 993 | uPrintF64 t24 |
| 994 | uPrint tW2Tab |
| 995 | uPrintF64 c30 |
| 996 | uPrint tW2Tab |
| 997 | uPrintF64 t30 |
| 998 | uPrint tW2Tab |
| 999 | uPrintF64 dTw |
| 1000 | uPrint tW2Tab |
| 1001 | uPrintF64 bulkSig |
| 1002 | uPrint tW2Tab |
| 1003 | uPrintF64 div bulkSig add dTw 0.0001f64 |
| 1004 | uPrint tW2Nl |
| 1005 | end |
| 1006 | |
| 1007 | fn main to int |
| 1008 | uPrint tW2Hdr |
| 1009 | for c ulong 8 |
| 1010 | buildConfig c |
| 1011 | evalPrims 0 c 0 |
| 1012 | applyGaugeTransform 0 1 |
| 1013 | evalPrims 1 c 1 |
| 1014 | end |
| 1015 | ufbiPriorRank |
| 1016 | uPrint tW2Prior |
| 1017 | for k ulong 4 |
| 1018 | printOpName get osOpOrder k |
| 1019 | uPrint tW2Sp |
| 1020 | end |
| 1021 | uPrint tW2Nl |
| 1022 | runBfsDepth0 |
| 1023 | runBfsDepth1 |
| 1024 | w1Cnt = get osSt 0 |
| 1025 | nMined = selectTopNodes 24 w1Cnt |
| 1026 | w1Best = get osTopScores 0 |
| 1027 | runBfsWave2 nMined |
| 1028 | w2Cnt = get osSt 0 |
| 1029 | uPrint tW2Stat |
| 1030 | uPrintU w2Cnt |
| 1031 | uPrint tW2GRej |
| 1032 | uPrintU get osSt 2 |
| 1033 | uPrint tW2EPrun |
| 1034 | uPrintU get osSt 3 |
| 1035 | uPrint tW2BrG |
| 1036 | uPrintU get osSt 4 |
| 1037 | uPrint tW2Occ |
| 1038 | uPrintU get osSt 1 |
| 1039 | uPrint tW2MPr |
| 1040 | uPrintU get osSt 5 |
| 1041 | uPrint tW2Wave1 |
| 1042 | uPrintU w1Cnt |
| 1043 | uPrint tW2Wave2 |
| 1044 | uPrintU sub w2Cnt w1Cnt |
| 1045 | uPrint tW2Nl |
| 1046 | uPrint tW2Col |
| 1047 | nTop = selectTopNodes 20 w2Cnt |
| 1048 | for r ulong nTop bound 20 |
| 1049 | printRankedRow add r 1 get osTopIds r |
| 1050 | end |
| 1051 | if lt get osSt 2 2 |
| 1052 | ret 1 |
| 1053 | end |
| 1054 | uPrint tW2Pass |
| 1055 | ret 0 |
| 1056 | end |