compute_eta_jets#
- t3toolbox.backend.sampling_derivatives.compute_eta_jets(tt_cores, mu_jets, nu_jets)#
def compute_eta_jets( tt_cores: typ.Sequence[NDArray], # len=d, elm_shape=C+(rLi,ni,rR(i+1)) mu_jets: typ.Sequence[NDArray], # len=d, elm_shape=(order+1,)+W+C+(rLi,) nu_jets: typ.Sequence[NDArray], # len=d, elm_shape=(order+1,)+W+C+(rR(i+1),) ) -> typ.Tuple[NDArray, ...]: # eta_jets. len=d, elm_shape=(order+1,)+W+C+(ni,)
Combine the left and right jets at each free mode (order-scan convolution).
eta_i^(t) = sum_{r+s=t} C(t,r) mu_{i-1}^(r) . G_i . nu_i^(s). eta is a FULL convolution (both jets run0..order): formed all at once, the spatial productmu . Ghas mode AND bond live at every order – an(order+1)*W*r^2intermediate (dtimes that vectorized over the cores: 128 GB at r=128, W=32000, order 5). This scans the two small axes instead, so only one slice is ever live:eta = sum_r (mu^(r)/r! . G) . sh^r nu,(sh x)^(t) = t x^(t-1),xscanover the input orderr(the convolution): formsmu^(r) . Gone order at a time and folds in the whole right jet, whose binomial weights the carriedsh^r nusupplies (sh^risr! C(t, r)times the shift byr) – removes the(order+1)factor;xmapover cores: removes thedfactor.
The win requires the UNIFORM path (a stacked supercore), where
xmap/xscandispatch to the realjax.lax.map/jax.lax.scan– both sequential (lax.mapis ascan, not a vectorizingvmap), so only one core+order intermediate is resident. On the RAGGED pathxmap/xscanare Python loops that unroll under jit and keep everything co-resident. Uniform, both scans: measured 14-28x smaller XLA peak than the vectorized dense form and CONSTANT in order. The order loop being a real scan is what forces this – an unrolled loop does not. Equal to the dense binomial form (the test suite’s twin) to ~1e-16.