Skip to main content

make_lsq_spline

Function make_lsq_spline 

Source
pub fn make_lsq_spline(
    x: &[f64],
    y: &[f64],
    t: &[f64],
    k: usize,
    w: Option<&[f64]>,
) -> Result<BSpline, ErrorsJSL>
Expand description

The least-squares spline of degree k on the knots t: minimises Σ (wᵢ (yᵢ − s(xᵢ)))² (SciPy’s make_lsq_spline; note that the weights multiply the residuals, not their squares). The data must satisfy the Schoenberg-Whitney conditions (each basis function must be non-zero at some data point) for the solution to be unique.