Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/yang/blob/main/src/ufbi_interval_rg_cert.om # yang This project has not described itself yet. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `yang / src / ufbi_interval_rg_cert.om` 317 lines ยท 7473 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 2 note src/ufbi_interval_rg_cert.om: Pure Seeded-OM-2 Zero-Monte-Carlo Deterministic 3 note Binary64 box estimates for the TV, W1, and character-expansion criteria. 4 note The scan uses padded endpoints over angle and staple-field boxes. 5 note End-to-end roundoff analysis remains open. 6 note Composed after: src/ufbi_math.om and src/ufbi_ivmath.om 7 8 note Interval scratch registers (each interval = 2 f64: [lo, hi]) 9 global ivA f64 2 10 global ivB f64 2 11 global ivC f64 2 12 global ivZ f64 2 13 global ivM f64 2 14 global ivM2 f64 2 15 global ivTh f64 2 16 global ivThC f64 2 17 global ivMad f64 2 18 global ivU12 f64 2 19 global ivU1 f64 2 20 global ivAcc f64 10 21 global ivStep f64 8 22 23 note Global estimated maxima across r in [0, 6*beta] 24 global maxMadHi f64 1 25 global maxW1Hi f64 1 26 global maxVparHi f64 1 27 global maxVperpHi f64 1 28 29 text tIvHdr "=== PHASE III-A ZERO-MONTE-CARLO INTERVAL-ARITHMETIC 4D SU(2) CONTRACTION VERIFIER (PURE OM-2) ===\n" 30 text tIvNote "# Padded binary64 [lo, hi] estimates (rel=1e-12, abs=1e-13), 2048 theta-boxes x 32 r-boxes covering ALL r in [0, 6*beta]\n" 31 text tIvCols "beta\tTV_osc_hi\tTV_S3L1_hi\tW1_geod_hi\tTG14_W1_hi\tu12_lo\tu12_hi\tu1_hi\tKP_surf_hi\tdecim_u12_4_hi\tcert_tier\n" 32 text tIvT0 "NONE" 33 text tIvT1 "T1_TV_OSC" 34 text tIvT2 "T2_TV_S3L1" 35 text tIvT3 "T3_W1_GEOD" 36 text tIvT3B "T3B_TG14_W1" 37 text tIvT4 "T4_KP_CHAR" 38 text tTab "\t" 39 text tNl "\n" 40 text tIvDone "INTERVAL_RG_CERT_DONE status=PASS\n" 41 42 fn min2 a f64 b f64 to f64 43 if lt a b 44 ret a 45 end 46 ret b 47 end 48 49 fn max2 a f64 b f64 to f64 50 if gt a b 51 ret a 52 end 53 ret b 54 end 55 56 fn ivMulLo alo f64 ahi f64 blo f64 bhi f64 to f64 57 p1 = mul alo blo 58 p2 = mul alo bhi 59 p3 = mul ahi blo 60 p4 = mul ahi bhi 61 ret ivLo min2 min2 p1 p2 min2 p3 p4 62 end 63 64 fn ivMulHi alo f64 ahi f64 blo f64 bhi f64 to f64 65 p1 = mul alo blo 66 p2 = mul alo bhi 67 p3 = mul ahi blo 68 p4 = mul ahi bhi 69 ret ivHi max2 max2 p1 p2 max2 p3 p4 70 end 71 72 note Box estimate of sin(t) on [t0, t1] subset [0, pi] 73 fn encloseS3Trig i ulong dt f64 to void 74 t0 = mul f64 i dt 75 t1 = mul f64 add i 1 dt 76 put ivStep 0 t0 77 put ivStep 1 t1 78 put ivStep 2 gridCosLo i 79 put ivStep 3 gridCosHi i 80 put ivStep 6 gridSinSqLo i 81 put ivStep 7 gridSinSqHi i 82 end 83 84 fn encloseS3Weight dt f64 rLo f64 rHi f64 to void 85 cLo = get ivStep 2 86 cHi = get ivStep 3 87 eLo = ivLo uExp64 ivMulLo rLo rHi cLo cHi 88 eHi = ivHi uExp64 ivMulHi rLo rHi cLo cHi 89 wScale = mul div 2.0f64 uPi dt 90 wLo = ivLo mul wScale mul get ivStep 6 eLo 91 wHi = ivHi mul wScale mul get ivStep 7 eHi 92 if lt wLo 0.0f64 93 wLo = 0.0f64 94 end 95 put ivStep 4 wLo 96 put ivStep 5 wHi 97 end 98 99 fn encloseS3Step i ulong dt f64 rLo f64 rHi f64 to void 100 encloseS3Trig i dt 101 encloseS3Weight dt rLo rHi 102 end 103 104 fn accumS3Step to void 105 t0 = get ivStep 0 106 t1 = get ivStep 1 107 cLo = get ivStep 2 108 cHi = get ivStep 3 109 wLo = get ivStep 4 110 wHi = get ivStep 5 111 put ivAcc 0 ivLo add get ivAcc 0 wLo 112 put ivAcc 1 ivHi add get ivAcc 1 wHi 113 put ivAcc 2 ivLo add get ivAcc 2 ivMulLo cLo cHi wLo wHi 114 put ivAcc 3 ivHi add get ivAcc 3 ivMulHi cLo cHi wLo wHi 115 csLo = 0.0f64 116 if gt cLo 0.0f64 117 csLo = ivLo mul cLo cLo 118 end 119 if lt cHi 0.0f64 120 csLo = ivLo mul cHi cHi 121 end 122 csHi = ivHi max2 mul cLo cLo mul cHi cHi 123 put ivAcc 4 ivLo add get ivAcc 4 mul csLo wLo 124 put ivAcc 5 ivHi add get ivAcc 5 mul csHi wHi 125 put ivAcc 6 ivLo add get ivAcc 6 mul t0 wLo 126 put ivAcc 7 ivHi add get ivAcc 7 mul t1 wHi 127 tcLoB = ivMulLo t0 t1 cLo cHi 128 tcHiB = ivMulHi t0 t1 cLo cHi 129 put ivAcc 8 ivLo add get ivAcc 8 ivMulLo tcLoB tcHiB wLo wHi 130 put ivAcc 9 ivHi add get ivAcc 9 ivMulHi tcLoB tcHiB wLo wHi 131 end 132 133 note Enclose S^3 vMF integrals uniformly over ALL r in [rLo, rHi] (0 <= rLo <= rHi) 134 note Outputs: ivZ, ivM, ivM2, ivTh, ivThC 135 fn encloseS3Box rLo f64 rHi f64 to void 136 dt = div uPi 2048.0f64 137 for k ulong 10 138 put ivAcc k 0.0f64 139 end 140 for i ulong 2048 141 encloseS3Step i dt rLo rHi 142 accumS3Step 143 end 144 zLo = get ivAcc 0 145 zHi = get ivAcc 1 146 put ivZ 0 zLo 147 put ivZ 1 zHi 148 put ivM 0 ivLo min2 div get ivAcc 2 zHi div get ivAcc 2 zLo 149 put ivM 1 ivHi max2 div get ivAcc 3 zLo div get ivAcc 3 zHi 150 put ivM2 0 ivLo div get ivAcc 4 zHi 151 put ivM2 1 ivHi div get ivAcc 5 zLo 152 put ivTh 0 ivLo div get ivAcc 6 zHi 153 put ivTh 1 ivHi div get ivAcc 7 zLo 154 put ivThC 0 ivLo min2 div get ivAcc 8 zHi div get ivAcc 8 zLo 155 put ivThC 1 ivHi max2 div get ivAcc 9 zLo div get ivAcc 9 zHi 156 end 157 158 fn encloseMadStep i ulong dt f64 rLo f64 rHi f64 to void 159 encloseS3Trig i dt 160 encloseS3Weight dt rLo rHi 161 dLo = ivLo sub get ivStep 2 get ivM 1 162 dHi = ivHi sub get ivStep 3 get ivM 0 163 absHi = max2 uAbs64 dLo uAbs64 dHi 164 put ivMad 0 ivHi add get ivMad 0 mul absHi get ivStep 5 165 end 166 167 note Separate pass for exact L1-MAD = E_r[|cos(t) - m(r)|] over r in [rLo, rHi] using enclosed m in [mLo, mHi] 168 fn encloseMadBox rLo f64 rHi f64 to void 169 dt = div uPi 2048.0f64 170 put ivMad 0 0.0f64 171 for i ulong 2048 172 encloseMadStep i dt rLo rHi 173 end 174 put ivMad 1 ivHi div get ivMad 0 get ivZ 0 175 end 176 177 fn uTanhHi x f64 to f64 178 if ge x 20.0f64 179 ret 1.0f64 180 end 181 e2 = ivHi uExp64 mul 2.0f64 x 182 e2lo = ivLo uExp64 mul 2.0f64 x 183 ret ivHi div sub e2 1.0f64 add e2lo 1.0f64 184 end 185 186 fn updateFieldMax r0 f64 r1 f64 to void 187 encloseS3Box r0 r1 188 encloseMadBox r0 r1 189 madH = get ivMad 1 190 if gt madH get maxMadHi 0 191 put maxMadHi 0 madH 192 end 193 prodHi = ivMulHi get ivTh 0 get ivTh 1 get ivM 0 get ivM 1 194 lParHi = ivHi sub prodHi get ivThC 0 195 if lt lParHi 0.0f64 196 lParHi = 0.0f64 197 end 198 lPerpHi = ivHi mul div uPi 8.0f64 sub 1.0f64 get ivM2 0 199 if lt lPerpHi 0.0f64 200 lPerpHi = 0.0f64 201 end 202 w1Hi = ivHi uSqrt64 ivHi add mul lParHi lParHi mul lPerpHi lPerpHi 203 if gt w1Hi get maxW1Hi 0 204 put maxW1Hi 0 w1Hi 205 end 206 end 207 208 note Scan ALL staple fields r in [0, 6*beta] in 32 interval boxes and report the coefficients. 209 fn certifyBeta beta f64 to void 210 dr = div mul 6.0f64 beta 32.0f64 211 put maxMadHi 0 0.0f64 212 put maxW1Hi 0 0.0f64 213 for k ulong 32 214 r0 = mul f64 k dr 215 r1 = mul f64 add k 1 dr 216 updateFieldMax r0 r1 217 end 218 219 encloseS3Box beta beta 220 put ivU12 0 get ivM 0 221 put ivU12 1 get ivM 1 222 put ivU1 1 ivHi div sub mul 4.0f64 get ivM2 1 1.0f64 3.0f64 223 224 tvOscHi = ivHi mul 18.0f64 uTanhHi beta 225 tvS3L1Hi = ivHi mul 18.0f64 mul beta get maxMadHi 0 226 w1GeodHi = ivHi mul 18.0f64 mul beta get maxW1Hi 0 227 tg14W1Hi = ivHi mul 14.0f64 mul beta get maxW1Hi 0 228 qKP = ivHi mul 13.`591409143f64` get ivU12 1 229 kpHi = 999.0f64 230 if lt qKP 0.999f64 231 q2 = ivHi mul qKP qKP 232 q6 = ivHi mul q2 mul q2 q2 233 kpHi = ivHi div mul 4.0f64 q6 sub 1.0f64 qKP 234 end 235 u2 = ivHi mul get ivU12 1 get ivU12 1 236 dec4Hi = ivHi mul u2 u2 237 238 uPrintF64 beta 239 uPrint tTab 240 uPrintF64 tvOscHi 241 uPrint tTab 242 uPrintF64 tvS3L1Hi 243 uPrint tTab 244 uPrintF64 w1GeodHi 245 uPrint tTab 246 uPrintF64 tg14W1Hi 247 uPrint tTab 248 uPrintF64 get ivU12 0 249 uPrint tTab 250 uPrintF64 get ivU12 1 251 uPrint tTab 252 uPrintF64 get ivU1 1 253 uPrint tTab 254 uPrintF64 kpHi 255 uPrint tTab 256 uPrintF64 dec4Hi 257 uPrint tTab 258 if lt tvOscHi 1.0f64 259 uPrint tIvT1 260 else 261 if lt tvS3L1Hi 1.0f64 262 uPrint tIvT2 263 else 264 if lt w1GeodHi 1.0f64 265 uPrint tIvT3 266 else 267 if lt tg14W1Hi 1.0f64 268 uPrint tIvT3B 269 else 270 if lt kpHi 1.0f64 271 uPrint tIvT4 272 else 273 uPrint tIvT0 274 end 275 end 276 end 277 end 278 end 279 uPrint tNl 280 end 281 282 text tTrigFail "TRIG_ENDPOINT status=FAIL\n" 283 284 fn main to int 285 initTrigGrid 286 if eq trigGridOK 0 287 uPrint tTrigFail 288 ret 1 289 end 290 uPrint tIvHdr 291 uPrint tIvNote 292 uPrint tIvCols 293 certifyBeta 0.05f64 294 certifyBeta 0.08f64 295 certifyBeta 0.10f64 296 certifyBeta 0.11f64 297 certifyBeta 0.12f64 298 certifyBeta 0.`1272f64` 299 certifyBeta 0.130f64 300 certifyBeta 0.135f64 301 certifyBeta 0.140f64 302 certifyBeta 0.150f64 303 certifyBeta 0.160f64 304 certifyBeta 0.170f64 305 certifyBeta 0.180f64 306 certifyBeta 0.200f64 307 certifyBeta 0.250f64 308 certifyBeta 0.300f64 309 certifyBeta 0.400f64 310 certifyBeta 0.500f64 311 certifyBeta 1.000f64 312 certifyBeta 1.500f64 313 certifyBeta 2.000f64 314 certifyBeta 2.300f64 315 uPrint tIvDone 316 ret 0 317 end