pytc.kmat.contract_K1_minus_K2_isdf_streaming¶
- pytc.kmat.contract_K1_minus_K2_isdf_streaming(phi_p, phi_q, phi_r, phi_s, grad_phi_p, grad_phi_q, U1, rank_block_size=128, panel_size=None)[source]¶
Streaming-capable wrapper around
contract_K1_minus_K2_isdf_jit().U1can be a devicejax.Arrayor a host numpy ndarray.panel_size=Noneorpanel_size >= U1.shape[1]→ delegate to the JIT once with the full K1; behaviour is bit-identical to the resident fast-path.Otherwise, iterate over axis-1 (rank-column) panels of
panel_size; each panel isjax.device_putjust before its call, phi_r/phi_s sliced to the matching slab, and partial contributions summed on device. Axis 0 of U1 (the k axis) is untouched.
The last panel is zero-padded to
panel_sizeso the JIT compiles once for the whole loop. Zero-padded rows/columns contribute 0 to the sum.Note: a function named
contract_K1_minus_K2_isdf(without the_streamingsuffix) already exists as a range-based wrapper that slices from a fullphi_piv/grad_phi_piv— keep the names distinct.