pub struct BSpline {
pub t: Vec<f64>,
pub c: Vec<f64>,
pub k: usize,
pub extrapolate: Extrapolate,
}Expand description
A spline s(x) = Σ cⱼ Bⱼ,ₖ(x) of degree k in the B-spline basis (SciPy’s BSpline).
Fields§
§t: Vec<f64>The knots, non-decreasing; n + k + 1 of them for n coefficients.
c: Vec<f64>The coefficients.
k: usizeThe degree.
extrapolate: ExtrapolateBehaviour outside [t[k], t[n]].
Implementations§
Source§impl BSpline
impl BSpline
Sourcepub fn new(t: Vec<f64>, c: Vec<f64>, k: usize) -> Result<Self, ErrorsJSL>
pub fn new(t: Vec<f64>, c: Vec<f64>, k: usize) -> Result<Self, ErrorsJSL>
A spline from knots, coefficients and degree; extrapolates by default.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
true when the spline has no coefficients (never, for a valid spline).
Sourcepub fn evaluate_derivative(&self, x: f64, nu: usize) -> f64
pub fn evaluate_derivative(&self, x: f64, nu: usize) -> f64
The nu-th derivative s⁽ⁿᵘ⁾(x), zero when nu > k.
Sourcepub fn evaluate_many(&self, x: &[f64]) -> Vec<f64>
pub fn evaluate_many(&self, x: &[f64]) -> Vec<f64>
The values at many points.
Sourcepub fn derivative(&self, nu: usize) -> Result<BSpline, ErrorsJSL>
pub fn derivative(&self, nu: usize) -> Result<BSpline, ErrorsJSL>
The derivative of order nu as a spline of degree k − nu on the knots with nu removed
from each end (SciPy’s BSpline.derivative):
c'ⱼ = k (cⱼ₊₁ − cⱼ) / (tⱼ₊ₖ₊₁ − tⱼ₊₁).
Sourcepub fn antiderivative(&self, nu: usize) -> BSpline
pub fn antiderivative(&self, nu: usize) -> BSpline
The antiderivative of order nu, a spline of degree k + nu that vanishes at t[0]
(SciPy’s BSpline.antiderivative): one end knot is added at each end and
Cⱼ₊₁ = Σᵢ≤ⱼ cᵢ (tᵢ₊ₖ₊₁ − tᵢ) / (k + 1).
Sourcepub fn integrate(&self, a: f64, b: f64) -> f64
pub fn integrate(&self, a: f64, b: f64) -> f64
∫ₐᵇ s(x) dx (SciPy’s BSpline.integrate). With Extrapolate::No the integrand is zero
outside the base interval; with Extrapolate::Periodic whole periods are counted.