LinearInterpolant
LinearInterpolant
Bases: Interpolant
Batched piecewise-linear 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.
fit(nodes_fit, dist)
Store linear interpolation support points.
Parameters:
-
nodes_fit(torch.Tensor of shape (batch_size, n_nodes)) –Fit nodes.
-
dist(torch.Tensor of shape (batch_size, n_nodes, ndim)) –Values at fit nodes.
Returns:
-
self(LinearInterpolant) –Fitted interpolant.
predict(t_eval)
Evaluate linear interpolation and piecewise-constant 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)) –Piecewise-constant time derivatives.