hookeai.simulators.fetorch.material.models.standard.hardening.torch_interp

torch_interp(x, xp, fp, left=None, right=None, is_check_data=False)[source]

1D linear interpolation for monotonically increasing data points.

Compatible with vectorized mapping.

Returns the one-dimensional piecewise linear interpolant to a function with given discrete data points (xp, fp), evaluated at x.

This function is essentially a torch-based implementation of numpy.interp.

Parameters:
  • x (torch.Tensor(1d)) – The x-coordinates at which to evaluate the interpolated values, sorted by increasing order.

  • xp (torch.Tensor(1d)) – The x-coordinates of the discrete data points, sorted by increasing order.

  • fp (torch.Tensor(1d)) – The y-coordinates of the discrete data points.

  • left (float, default=None) – Value to return for x < xp[0]. Defaults to fp[0].

  • right (float, default=None) – Value to return for x > xp[-1]. Defaults to fp[-1].

  • is_check_data (bool, default=False) – If True, then check data required to perform linear interpolation.

Returns:

y – The y-coordinates of the interpolated data points.

Return type:

torch.Tensor(1d)