TensorSpline
Tensor-product spline over multiple dimensions.
Declaration
classdef TensorSpline < CAAnnotatedClassOverview
TensorSpline is the multidimensional extension of BSpline. It stores one spline degree and one knot vector per dimension, together with a tensor-product coefficient array.
The represented spline is
\[f(x_1,\ldots,x_d) = x_{\mathrm{Mean}} + x_{\mathrm{Std}} \sum_{j_1=1}^{M_1} \cdots \sum_{j_d=1}^{M_d} \xi_{j_1,\ldots,j_d} \prod_{k=1}^{d} B_{j_k,S_k}(x_k;\tau_k),\]where each \(\tau_k\) is the knot vector for one coordinate direction. Evaluation is pointwise on matching-size query arrays: paired column vectors evaluate paired sample locations, while matching ndgrid arrays evaluate a tensor-product lattice.
Basic usage
Use TensorSpline.fromKnotPoints(...) when you already have knot vectors and tensor-product coefficients and want to evaluate the resulting spline on matching-size query arrays. The low-level TensorSpline(...) constructor is the cheap solved-state constructor used directly by persistence and other internal bootstrap paths.
knotPoints = {[0;0;0;0;1;1;1;1], [0;0;0;0;1;1;1;1]};
xi = randn(16,1);
spline = TensorSpline.fromKnotPoints(knotPoints, xi, S=[3 3]);
[Xq,Yq] = ndgrid(linspace(0,1,40), linspace(0,1,40));
F = spline(Xq, Yq);
Topics
- Create a spline
TensorSplineCreate a tensor-product spline from canonical solved state.fromKnotPointsCreate a tensor-product spline from numeric knot vectors and coefficients.
- Inspect spline properties
KSpline order in each tensor dimension.SPolynomial degree in each tensor dimension.basisSizeNumber of basis functions in each dimension.domainMinimum and maximum values of the spline domain in each dimension.knotAxesKnot-axis objects defining the spline basis.knotPointsKnot vectors defining the spline basis.numDimensionsNumber of tensor dimensions.xMeanMean added back to zero-order evaluations.xStdMultiplicative scale applied to evaluations.xiTensor-product spline coefficients reshaped to basisSize.
- Evaluate the spline
fevalEvaluate a tensor spline at matching-size query arrays.subsrefEvaluate the tensor spline with function-call syntax or defer to built-in indexing.valueAtPointsEvaluate the tensor spline or a mixed partial derivative.
- Transform the spline
cumsumReturn the indefinite integral along one tensor dimension.diffReturn a tensor spline representing mixed partial derivatives.mtimesMultiply tensor-spline outputs by a scalar.plusAdd a scalar offset to tensor-spline outputs.powerRaise tensor-spline values to a positive scalar power by refitting support values.rootsReturn real roots of a one-dimensional tensor spline within its domain.sqrtReturn a tensor spline approximation to the square root of the spline output.
- Build spline bases
matrixForPointMatrixEvaluate the tensor-product basis matrix and optional derivatives.pointsFromGridVectorsConvert rectilinear grid vectors into an explicit point matrix.pointsOfSupportFromKnotPointsReturn representative support points for a tensor-product spline basis.