/** * WASM dispatch bridge for Bessel J/Y and Airy Ai/Bi array kernels. * * Kernels exposed (Bessel — Slice 3.10c-1; Airy — Slice 4.9): * - `bessel_j0_f64` — J0(x) applied element-wise over a Float64Array * - `bessel_j1_f64` — J1(x) applied element-wise * - `bessel_j_f64` — J_n(x) applied element-wise (fixed integer order n) * - `bessel_y0_f64` — Y0(x) applied element-wise * - `bessel_y1_f64` — Y1(x) applied element-wise * - `bessel_y_f64` — Y_n(x) applied element-wise (fixed integer order n) * - `airy_ai_f64` — Ai(x) applied element-wise * - `airy_bi_f64` — Bi(x) applied element-wise * * Dispatch order (for arrays ≥ WASM_SPECIAL_THRESHOLD = 1024 elements): * 1. AS managed kernel (the binary the functions package bundles). * 2. Fall back to pure-JS implementation. * * AS parity (Slice 4.9): `assembly/src/special.ts` implements the Bessel/Y and * lgamma/elliptic kernels with the same algorithms, validated ≤1e-12 vs the JS * reference. (Airy was the last holdout — its AS asymptotic series needed the * Phase 6 truncation cap, after which AS vs JS agree to ≈4e-16; see the note * above `airyAiDispatch`, which now routes to AS like its siblings.) The legacy * native-pointer path was removed from this bridge in the Phase 5 AS cutover. * * Any thrown error is swallowed and the JS fallback runs — the WASM tier * is an optimisation, not a correctness requirement. * * Threshold: * The pointer-marshal overhead (2 memcpys in + 1 out) pays off for arrays * of ≥ 1024 elements. Verified empirically; see * `tools/benchmark/wasm/special.bench.ts`. */ /** * Element-count threshold above which we attempt the WASM Bessel kernels. */ export declare const WASM_SPECIAL_THRESHOLD = 1024; /** JS fallback: J0(x) for all x. */ export declare function besselJ0JS(xs: Float64Array): Float64Array; /** JS fallback: J1(x) for all x. */ export declare function besselJ1JS(xs: Float64Array): Float64Array; /** JS fallback: J_n(x) for all x. */ export declare function besselJnJS(n: number, xs: Float64Array): Float64Array; /** JS fallback: Y0(x) for all x (NaN for x ≤ 0). */ export declare function besselY0JS(xs: Float64Array): Float64Array; /** JS fallback: Y1(x) for all x (NaN for x ≤ 0). */ export declare function besselY1JS(xs: Float64Array): Float64Array; /** JS fallback: Y_n(x) for all x (NaN for x ≤ 0). */ export declare function besselYnJS(n: number, xs: Float64Array): Float64Array; /** JS fallback: Ai(x) for all x. */ export declare function airyAiJS(xs: Float64Array): Float64Array; /** JS fallback: Bi(x) for all x. */ export declare function airyBiJS(xs: Float64Array): Float64Array; /** * Dispatch J0/J1/Y0/Y1 — and the order-fixed J_n/Y_n — over an array. * AS managed kernel → JS. All AS special kernels here bit-/tol-match the JS * reference to ≤1e-12 (verified Phase 3b), so they are repointed via the shared * `makeUnaryArrayDispatch` factory. */ export declare const besselJ0Dispatch: (xs: Float64Array) => Float64Array; export declare const besselJ1Dispatch: (xs: Float64Array) => Float64Array; /** Dispatch J_order over an array — AS managed, then JS. */ export declare function besselJDispatch(order: number, xs: Float64Array): Float64Array; export declare const besselY0Dispatch: (xs: Float64Array) => Float64Array; export declare const besselY1Dispatch: (xs: Float64Array) => Float64Array; /** Dispatch Y_order over an array — AS managed, then JS. */ export declare function besselYDispatch(order: number, xs: Float64Array): Float64Array; /** * Dispatch Ai(x) / Bi(x) over an array — AS managed → JS (Phase 6). * * The AS Airy asymptotic kernel now mirrors the JS reference exactly: its * asymptotic sum is capped at the same 13-term (u_0..u_12) truncation as the * JS `_airyAsymPos` / `_airyAsymNeg` table (see `AIRY_U_MAX` in * assembly/src/special.ts). Previously the AS kernel generated u_k by recurrence * and ran to its own optimal truncation (k≈15 near x≈5), diverging ~1e-7 from * the JS value it is meant to match. With the cap, AS vs JS agree to ≈4e-16 * (relative) across the |x|>5 region (verified Phase 6), so these are repointed * via the shared `makeUnaryArrayDispatch` factory (JS fallback retained). */ export declare const airyAiDispatch: (xs: Float64Array) => Float64Array; export declare const airyBiDispatch: (xs: Float64Array) => Float64Array; /** JS fallback: lgamma(x) applied element-wise (canonical `_lgamma`). */ export declare function lgammaJS(xs: Float64Array): Float64Array; /** * Dispatch lgamma over an array — AS managed above threshold, then JS. * * For arrays ≥ WASM_SPECIAL_THRESHOLD (1024): * 1. AS managed `lgamma_f64` kernel (the binary the functions package bundles). * 2. Fall back to pure-JS `lgammaJS`. */ export declare const lgammaDispatch: (xs: Float64Array) => Float64Array; /** * Compute the Carlson integral RC(x, y) for each pair of elements, in JavaScript. * * The function reads element `i` of each input array and writes element `i` of a new * array. It does not change the inputs. * An element with `x < 0` or `y <= 0` gives NaN. */ export declare function carlsonRCJS(xs: Float64Array, ys: Float64Array): Float64Array; /** * Compute the Carlson integral RF(x, y, z) for each element triple, in JavaScript. * * The function reads element `i` of each input array and writes element `i` of a new * array. It does not change the inputs. * An element with a negative argument gives NaN. */ export declare function carlsonRFJS(xs: Float64Array, ys: Float64Array, zs: Float64Array): Float64Array; /** * Compute the Carlson integral RD(x, y, z) for each element triple, in JavaScript. * * The function reads element `i` of each input array and writes element `i` of a new * array. It does not change the inputs. * An element with `x < 0`, `y < 0`, `z <= 0`, or `x` and `y` both 0 gives NaN. */ export declare function carlsonRDJS(xs: Float64Array, ys: Float64Array, zs: Float64Array): Float64Array; /** * Compute the Carlson integral RJ(x, y, z, p) for each element set, in JavaScript. * * The function reads element `i` of each input array and writes element `i` of a new * array. It does not change the inputs. * An element with a negative `x`, `y` or `z`, or with `p` equal to 0, gives NaN. */ export declare function carlsonRJJS(xs: Float64Array, ys: Float64Array, zs: Float64Array, ps: Float64Array): Float64Array; /** * Compute the incomplete elliptic integral of the first kind F(phi | m) for each element * pair, in JavaScript. * * The function reads element `i` of each input array and writes element `i` of a new * array. It does not change the inputs. * An element with `1 - m sin^2(phi) < 0` gives NaN. */ export declare function ellipticFIncompleteJS(phis: Float64Array, ms: Float64Array): Float64Array; /** * Compute the incomplete elliptic integral of the second kind E(phi | m) for each element * pair, in JavaScript. * * The function reads element `i` of each input array and writes element `i` of a new * array. It does not change the inputs. * An element with `1 - m sin^2(phi) < 0` gives NaN. */ export declare function ellipticEIncompleteJS(phis: Float64Array, ms: Float64Array): Float64Array; /** * Compute the incomplete elliptic integral of the third kind Pi(n; phi | m) for each * element set, in JavaScript. * * The function reads element `i` of each input array and writes element `i` of a new * array. It does not change the inputs. * An element with `1 - m sin^2(phi) < 0` or `1 - n sin^2(phi) <= 0` gives NaN. */ export declare function ellipticPiIncompleteJS(ns: Float64Array, phis: Float64Array, ms: Float64Array): Float64Array; /** Return the Carlson integral RC(x, y). The result is NaN if `x < 0` or `y <= 0`. */ export declare function carlsonRCScalar(x: number, y: number): number; /** Return the Carlson integral RF(x, y, z). The result is NaN if an argument is negative. */ export declare function carlsonRFScalar(x: number, y: number, z: number): number; /** * Return the Carlson integral RD(x, y, z). * * The result is NaN if `x < 0`, `y < 0`, `z <= 0`, or `x` and `y` are both 0. */ export declare function carlsonRDScalar(x: number, y: number, z: number): number; /** * Return the Carlson integral RJ(x, y, z, p). * * The result is NaN if `x`, `y` or `z` is negative, or if `p` is 0. */ export declare function carlsonRJScalar(x: number, y: number, z: number, p: number): number; /** * Return the incomplete elliptic integral of the first kind F(phi | m). * * The result is 0 if `phi` is 0, and NaN if `1 - m sin^2(phi) < 0`. */ export declare function ellipticFIncompleteScalar(phi: number, m: number): number; /** * Return the incomplete elliptic integral of the second kind E(phi | m). * * The result is 0 if `phi` is 0, and NaN if `1 - m sin^2(phi) < 0`. */ export declare function ellipticEIncompleteScalar(phi: number, m: number): number; /** * Return the incomplete elliptic integral of the third kind Pi(n; phi | m). * * The result is 0 if `phi` is 0. It is NaN if `1 - m sin^2(phi) < 0` or * `1 - n sin^2(phi) <= 0`. */ export declare function ellipticPiIncompleteScalar(n: number, phi: number, m: number): number; /** Dispatch RC(x, y) element-wise — AS managed → JS. */ export declare function carlsonRCDispatch(xs: Float64Array, ys: Float64Array): Float64Array; /** Dispatch RF(x, y, z) element-wise. */ export declare function carlsonRFDispatch(xs: Float64Array, ys: Float64Array, zs: Float64Array): Float64Array; /** Dispatch RD(x, y, z) element-wise. */ export declare function carlsonRDDispatch(xs: Float64Array, ys: Float64Array, zs: Float64Array): Float64Array; /** Dispatch RJ(x, y, z, p) element-wise. */ export declare function carlsonRJDispatch(xs: Float64Array, ys: Float64Array, zs: Float64Array, ps: Float64Array): Float64Array; /** Dispatch F(φ, m) element-wise. */ export declare function ellipticFIncompleteDispatch(phis: Float64Array, ms: Float64Array): Float64Array; /** Dispatch E(φ, m) (incomplete) element-wise. */ export declare function ellipticEIncompleteDispatch(phis: Float64Array, ms: Float64Array): Float64Array; /** Dispatch Π(n, φ, m) element-wise. */ export declare function ellipticPiIncompleteDispatch(ns: Float64Array, phis: Float64Array, ms: Float64Array): Float64Array; /** * Test-only hook — re-exported so tests can reset loader state * without importing WasmLoader directly. */ export declare function resetBesselWasm(): void; /** * Test-only alias for Airy reset (uses same singleton). */ export declare function resetAiryWasm(): void; /** * Test-only alias for Elliptic reset (uses same singleton). */ export declare function resetEllipticWasm(): void; /** * Test-only alias for lgamma reset (uses same singleton). */ export declare function resetLgammaWasm(): void; /** JS fallback: K(m) applied element-wise (canonical `ellipticKScalar`). */ export declare function ellipticKJS(ms: Float64Array): Float64Array; /** JS fallback: E(m) applied element-wise (canonical `ellipticECompleteScalar`). */ export declare function ellipticEJS(ms: Float64Array): Float64Array; /** Dispatch K(m) over an array — AS managed → JS. */ export declare const ellipticKDispatch: (xs: Float64Array) => Float64Array; /** Dispatch E(m) over an array — AS managed → JS. */ export declare const ellipticEDispatch: (xs: Float64Array) => Float64Array; //# sourceMappingURL=wasm-bridge.d.ts.map