SplineInterpolant
SplineInterpolant
Bases: Interpolant
Batched natural cubic spline interpolant.
Attributes:
-
t_fit_(torch.Tensor of shape (batch_size, n_nodes)) –Fit nodes stored during
fit. -
y_fit_(torch.Tensor of shape (batch_size, n_nodes, ndim)) –Trajectory values stored during
fit. -
spline_(NaturalCubicSpline) –Fitted spline object created during
fit.
fit(nodes_fit, dist)
Fit natural cubic spline coefficients.
Parameters:
-
nodes_fit(torch.Tensor of shape (batch_size, n_nodes)) –Fit nodes.
-
dist(torch.Tensor of shape (batch_size, n_nodes, ndim)) –Trajectory values at fit nodes.
Returns:
-
self(SplineInterpolant) –Fitted interpolant.
predict(t_eval)
Evaluate spline interpolation and derivative.
Parameters:
-
t_eval(torch.Tensor of shape (batch_size, n_eval)) –Evaluation nodes.
Returns:
-
interp(torch.Tensor of shape (batch_size, n_eval, ndim)) –Interpolated values.
-
deriv(torch.Tensor of shape (batch_size, n_eval, ndim)) –Time derivatives.