Commit d620851
committed
feat(wing): analytic wing-seed for |k_log| in [2.95, 8.0]
Add an analytic wing-seed for the deep-wing regime, derived clean-room
from Schadner's IG-quantile and the 2-term Mills asymptotic. Replaces a
v1.0.0 path that extrapolated the Chebyshev seed beyond its fit domain
(SEED_K_HI = 3.0) and produced 3.27e-1 catastrophic errors on a
wing-saturated v x Delta stress grid.
Algorithm. For an OTM option with h = |k_log| and IG-survival
q_surv = (1 - c_*)/m:
z1_0 = -Phi^-1(q_surv); u_0 = -z1_0 + sqrt(z1_0^2 + 2h) (W0 lead)
for n in 0..N_PICARD:
z2 = h/u + u/2
Q = 1/z2 - 1/z2^3 (Mills)
phi = (2*pi)^(-1/2) * exp(-z1^2 / 2)
delta = phi * Q (= e^h * Phi(-z2), no overflow)
z1 = -Phi^-1(q_surv + delta)
u = -z1 + sqrt(z1^2 + 2h)
v = u
The collapse e^h * Phi(-z2) === phi(z1) * Q(z2) (with Q(z) :=
sqrt(pi/2) * erfcx(z/sqrt(2)) ~ 1/z - 1/z^3) eliminates the exp(h)
overflow on the wing. N_PICARD = 1 followed by HH3 polish lands at the
f64 conditioning floor.
Dispatch gates (chosen by Wren G's analysis):
- h >= K_HI_BAILOUT = 2.95 (wing regime starts at |k_log| ~ 3)
- q_surv < WING_Q_MAX = 0.30 (deep-OTM, the wing's natural support)
- h < WING_H_MAX = 8.0 (above this the Mills truncation breaks
down; route to Jaeckel rational fallback)
q-convention fix at the wing dispatch site. The IG kernel's q is the IG
CDF; the wing analytic uses IG survival. Without the conversion
`q_surv = 1 - q_kernel`, the wing seed receives the wrong probability
and the dispatch is silently wrong on a band of the wing grid. Caught
during integration, verifier-confirmed.
Cost on the wing v x Delta stress grid (360 cases, T = 1, F = 1, median
of 7 runs of 5000 reps each, single AVX-512 core, taskset -c 0):
pre-wing (v1.0.0): Cheb extrapolation, 3.27e-1 max abs error
post-wing (v1.0.1): analytic seed, 8.30e-12 max abs error
throughput: 81.3 ns/option (+8 ns vs Chebyshev path)
Schadner cold (1M synthetic options, the canonical grid) is unchanged:
73 ns / 3.42e-11 / 0 NaN. The wing path costs ~8 ns when it fires;
the Chebyshev path's 73 ns dominates the synthetic distribution.
Two pre-existing NaN on the wing v x Delta grid at (v=0.01, Delta in
{0.30, 0.70}): tiny-sigma near-ATM puts at the f64 BS price floor
(< 1e-7) where the f64 inverse is not meaningful. Pinned by
tests/wing_seed.rs::volfi_wing_grid_nan_set_bounded_to_two so a future
inner-iteration edit cannot silently expand the NaN set.
Files:
- src/schadner_fast.rs: +wing_seed_simd, +dispatch gates, clamps
- src/otm_context.rs: +dispatch in solve_with_ctx_simd
- tests/wing_seed.rs: +9 tests (Wren G corner, mpmath-200-bit
reference at h in {3..8} x q in {0.01..0.30},
boundary finiteness, SIMD lane independence,
kernel sigma recovery, Cheb non-regression,
context-API routing, NaN-set regression pin)
- bench/wing_grid.rs: +volfi-style v x Delta stress harness
- scripts/wing_ref_gen.py: +regenerates WING_REF from mpmath 200-bit
- Cargo.toml: +wing_grid binary entry1 parent 9f2e44a commit d620851
6 files changed
Lines changed: 991 additions & 11 deletions
File tree
- bench
- scripts
- src
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
481 | 481 | | |
482 | 482 | | |
483 | 483 | | |
484 | | - | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
485 | 511 | | |
486 | 512 | | |
487 | 513 | | |
| |||
0 commit comments