/** * WASM dispatch bridge for the tridiagonal-solve and divided-difference * hot loops (Slices 3.10b and 5.5). * * Two kernels are exposed: * - `tridiag_solve_f64` — O(n) Thomas algorithm for a tridiagonal system * - `divided_difference_f64` — O(n²) Newton divided-difference table * * Behavior: * - When `wasmLoader.getModule()` returns null (module not loaded or * load failed) or the loaded module is not the AS binary, the helper * returns the JS fallback result without throwing. * - When the AS binary is loaded, we marshal the Float64Array operands * into AS managed arrays, run the kernel, and return a JS-side copy of * the result. * - Any thrown error is swallowed and the JS fallback runs — the * WASM tier is an optimisation, not a correctness requirement. * - The legacy native-pointer path was removed from this bridge in the * migration Phase 5 functions cutover. * * Threshold: * The marshal cost (four memcpys in + one out) pays off when the O(n) * inner loop is large enough. A knot-count of ≥ 1024 is the * empirically-chosen break-even point; see * `tools/benchmark/wasm/tridiag.bench.ts`. */ /** * Knot-count threshold above which we attempt the WASM tridiag kernel. * Gated on the length of `diag` (== number of unknowns). */ export declare const WASM_TRIDIAG_THRESHOLD = 1024; /** * Knot-count threshold above which we attempt the WASM divided-difference * kernel. The O(n²) table is large enough to benefit from WASM at ≥ 256 * knots; below that, marshal overhead dominates. */ export declare const WASM_INTERP_THRESHOLD = 256; /** * Pure-JS Thomas algorithm — used as the below-threshold / no-WASM fallback. * * Solves a tridiagonal system A·x = rhs in O(n). * * @param diag - main diagonal, length n * @param lower - sub-diagonal, length n-1 * @param upper - super-diagonal, length n-1 * @param rhs - right-hand side, length n * @returns solution x, length n */ export declare function tridiagSolveJS(diag: Float64Array, lower: Float64Array, upper: Float64Array, rhs: Float64Array): Float64Array; /** * Solve a tridiagonal system via WASM when `diag.length` is at or above * the threshold, otherwise falls back to the inline JS Thomas algorithm. * * @param diag - main diagonal, length n * @param lower - sub-diagonal, length n-1 * @param upper - super-diagonal, length n-1 * @param rhs - right-hand side, length n * @returns solution Float64Array of length n */ export declare function tridiagSolveDispatch(diag: Float64Array, lower: Float64Array, upper: Float64Array, rhs: Float64Array): Float64Array; /** * Test-only hook — re-exported so tests can reset loader state * without importing WasmLoader directly. */ export declare function resetTridiagWasm(): void; /** * Pure-JS Newton divided-difference computation — used as the * below-threshold / no-WASM fallback. * * Given n distinct nodes (xs, ys), returns a Float64Array of n Newton-form * coefficients c_0 … c_{n-1} such that: * * P(x) = c_0 + c_1·(x-x_0) + c_2·(x-x_0)(x-x_1) + … * * Throws `RangeError` when any two x-values are equal (degenerate input). * * @param xs - interpolation nodes (distinct) * @param ys - function values at xs * @returns Newton-form coefficient array of length n */ export declare function dividedDifferenceJS(xs: Float64Array, ys: Float64Array): Float64Array; /** * Compute Newton divided-difference coefficients via WASM when * `xs.length` is at or above WASM_INTERP_THRESHOLD, otherwise falls * back to the inline JS implementation. * * @param xs - interpolation nodes (distinct), length n * @param ys - function values at xs, length n * @returns Newton-form coefficient Float64Array of length n * @throws RangeError on duplicate x-values (JS path only; WASM path * falls back to JS on error return) */ export declare function dividedDifferenceDispatch(xs: Float64Array, ys: Float64Array): Float64Array; //# sourceMappingURL=wasm-bridge.d.ts.map