type f64 = number; type i32 = number; /** Options for {@link bsplineFit}. */ export interface BSplineFitOptions { /** Spline degree (default 3, cubic). */ k?: i32; /** Smoothing factor. `0` (default) fits an interpolating spline that * passes through every data point exactly. `s > 0` requests a * least-squares smoothing spline with fewer basis functions than data * points — the number of interior knots shrinks roughly in proportion to * `s`. Use `nknots` to control the knot count directly instead. */ s?: f64; /** Explicit number of interior knots for a smoothing fit (used whenever * `s > 0`, or set this directly with `s` left at 0). Overrides the * `s`-derived heuristic. */ nknots?: i32; } /** A fitted B-spline in scipy's `tck` tuple shape: knot vector `t`, * coefficients `c`, and degree `k`. */ export interface BSplineTuple { t: f64[]; c: f64[]; k: i32; } /** * Fit a B-spline of degree `k` (default cubic) to data `(x, y)`, returned * in scipy's `tck` tuple shape `{ t, c, k }`. * * @example * const xs = Array.from({ length: 15 }, (_, i) => (i * 2 * Math.PI) / 14); * const ys = xs.map(Math.sin); * const tck = bsplineFit(xs, ys); // cubic interpolating spline (s=0) * bsplineEval(tck, xs[3]); // === ys[3] exactly (interpolation) */ export declare function bsplineFit(x: readonly f64[], y: readonly f64[], opts?: BSplineFitOptions): BSplineTuple; /** * Evaluate a fitted B-spline (de Boor's algorithm) at one point or an array * of points. * * @example * bsplineEval(bsplineFit(xs, ys), 1.0); // spline value at x=1 * bsplineEval(bsplineFit(xs, ys), [1, 2, 3]); // vectorized */ export declare function bsplineEval(spline: BSplineTuple, xnew: f64): f64; export declare function bsplineEval(spline: BSplineTuple, xnew: readonly f64[]): f64[]; export {}; //# sourceMappingURL=bspline.d.ts.map