Expand description
In-house interpolation & approximation for the tpt-math substrate.
This crate provides scattered-data and surrogate-modelling routines built
on top of the tpt_math_linalg_dense storage and the
tpt_math_numeric Scalar trait, with no external interpolation
backend:
RbfInterpolator— radial-basis-function interpolation with the thin-plate, Gaussian and multiquadric kernels, weights solved via the dense linear solver.Kriging— ordinary Kriging with a configurable variogram model (spherical, exponential, Gaussian or linear), returning the prediction and the Kriging variance.Pchip— shape-preserving piecewise-cubic-Hermite interpolation that provably preserves monotonicity of the data.bspline_basisandBsplineCurve— Cox–de Boor B-spline basis evaluation and a weighted B-spline curve.
§Why in-house?
The commonly used scirs2-interpolate crate is Apache-2.0-only, which is
disqualified by this substrate’s dual MIT/Apache-2.0 license policy
(see ADR-0007). All routines here are implemented from scratch so there is
no license exposure and nothing to vendor.
§Features
std(default) — enable the allocator and thestdsupport of deps.alloc— signal allocator availability (dynamic vectors need it).
§Examples
use tpt_math_interpolate::{RbfInterpolator, RbfKernel};
use tpt_math_linalg_dense::DVector;
let xs = DVector::from_vec(vec![0.0_f64, 1.0, 2.0]);
let ys = DVector::from_vec(vec![0.0_f64, 1.0, 4.0]);
let rbf = RbfInterpolator::new(xs, ys, RbfKernel::Gaussian { epsilon: 1.5 }).unwrap();
// RBF interpolation is exact at the sample nodes.
assert!((rbf.eval(1.0) - 1.0).abs() < 1e-6);Structs§
- Bspline
Curve - A weighted B-spline curve
C(x) = Σ_i w_i · B_{i,p}(x). - Kriging
- An ordinary-Kriging surrogate of scattered 1-D data.
- Kriging
Nd - An ordinary-Kriging surrogate of scattered data in
ddimensions. - Multilinear
Grid - Multilinear (bilinear in 2-D, trilinear in 3-D, …) interpolation on a rectilinear grid.
- Natural
Cubic Spline - A natural cubic spline through
(x_i, y_i). - Pchip
- Shape-preserving piecewise-cubic-Hermite interpolant (PCHIP).
- RbfInterpolator
- A radial-basis-function interpolant of scattered 1-D data.
- RbfInterpolator
Nd - A radial-basis-function interpolant of scattered data in
ddimensions.
Enums§
- RbfKernel
- Radial kernels available for
RbfInterpolator. - Variogram
- A variogram model
γ(h)describing the spatial correlation of residuals.
Functions§
- bspline_
basis - Evaluate the
i-th B-spline basis function of the givendegreeatx.