docstr: Computes the interpolation kernel u() for points X given the scaled
  grid distances:
                              (X-x_{t})/s
  where s is the distance between neighboring grid points. Note that,
  in this context, the word "kernel" is not used to mean a covariance
  function as in the rest of the package. For more details, see the
  original paper Keys et al., 1989, equation (4).
  
  scaled_grid_dist should be an n-by-g matrix of distances, where the
  (ij)th element is the distance between the ith data point in X and the
  jth element in the grid.
  
  Note that, although this method ultimately expects a scaled distance matrix,
  it is only intended to be used on single dimensional data.
docstr_tok: ["Computes","the","interpolation","kernel","u","(",")","for","points","X","given","the","scaled","grid","distances",":","(","X-x_","{","t","}",")","\/s","where","s","is","the","distance","between","neighboring","grid","points",".","Note","that",",","in","this","context",",","the","word","``","kernel","''","is","not","used","to","mean","a","covariance","function","as","in","the","rest","of","the","package",".","For","more","details",",","see","the","original","paper","Keys","et","al.",",","1989",",","equation","(","4",")",".","scaled_grid_dist","should","be","an","n-by-g","matrix","of","distances",",","where","the","(","ij",")","th","element","is","the","distance","between","the","ith","data","point","in","X","and","the","jth","element","in","the","grid",".","Note","that",",","although","this","method","ultimately","expects","a","scaled","distance","matrix",",","it","is","only","intended","to","be","used","on","single","dimensional","data","."]
code: def _cubic_interpolation_kernel(self, scaled_grid_dist):
      """
      Computes the interpolation kernel u() for points X given the scaled
      grid distances:
                                  (X-x_{t})/s
      where s is the distance between neighboring grid points. Note that,
      in this context, the word "kernel" is not used to mean a covariance
      function as in the rest of the package. For more details, see the
      original paper Keys et al., 1989, equation (4).
  
      scaled_grid_dist should be an n-by-g matrix of distances, where the
      (ij)th element is the distance between the ith data point in X and the
      jth element in the grid.
  
      Note that, although this method ultimately expects a scaled distance matrix,
      it is only intended to be used on single dimensional data.
      """
      U = scaled_grid_dist.abs()
      res = torch.zeros(U.size(), dtype=U.dtype, device=U.device)
  
      U_lt_1 = 1 - U.floor().clamp(0, 1)  # U, if U < 1, 0 otherwise
      res = res + (((1.5 * U - 2.5).mul(U)).mul(U) + 1) * U_lt_1
  
      # u(s) = -0.5|s|^3 + 2.5|s|^2 - 4|s| + 2 when 1 < |s| < 2
      U_ge_1_le_2 = 1 - U_lt_1  # U, if U <= 1 <= 2, 0 otherwise
      res = (
          res + (((-0.5 * U + 2.5).mul(U) - 4).mul(U) + 2) * U_ge_1_le_2
      )
      return res
  
file_path: gpytorch/gpytorch/utils/interpolation.py
imports: import warnings
  from functools import reduce
  from operator import mul
  from typing import List
  import torch
  from linear_operator.utils.interpolation import left_interp, left_t_interp
  from .grid import convert_legacy_grid
label_desc: Use image node_id 1 for calling the Interpolation obj's underlying member method code with example usage: obj._cubic_interpolation_kernel(scaled_grid_dist) and returns: res