def METHOD_NAME(self, grid, values, x):
    """
    Compute cubic spline coefficients that give continuity of second derivatives.
    This requires solution of a tri-diagonal system, which is done with a forward and
    a reverse pass.
    Parameters
    ----------
    grid : tuple(ndarray)
        Tuple containing x grid locations for this dimension.
    values : ndarray
        Array containing the values to be interpolated.
    x : ndarray
        The coordinates to sample the gridded data at. Only needed to query the dtype for
        complex step.
    Returns
    -------
    ndarray
        Coefficients for cubic spline.
    """
    n = len(grid)
    # Complex Step
    if values.dtype == complex:
        dtype = values.dtype
    else:
        dtype = x.dtype
    # Natural spline has second deriv=0 at both ends
    sec_deriv = np.zeros(n, dtype=dtype)
    temp = np.zeros(values.shape, dtype=dtype)
    # Subdiagonal stripe.
    mu = (grid[1:n - 1] - grid[:n - 2]) / (grid[2:] - grid[:n - 2])
    # Right hand sides.
    vdiff = (values[..., 1:] - values[..., :n - 1]) / (grid[1:] - grid[:n - 1])
    tmp = 6.0 * (vdiff[..., 1:] - vdiff[..., :n - 2]) / (grid[2:] - grid[:n - 2])
    for i in range(1, n - 1):
        prtl = 1.0 / (mu[i - 1] * sec_deriv[..., i - 1] + 2.0)
        sec_deriv[i] = (mu[i - 1] - 1.0) * prtl
        temp[..., i] = (tmp[..., i - 1] - mu[i - 1] * temp[..., i - 1]) * prtl
    sec_deriv = np.array(np.broadcast_to(sec_deriv, temp.shape), dtype=dtype)
    for i in range(n - 2, 0, -1):
        sec_deriv[..., i] = sec_deriv[..., i] * sec_deriv[..., i + 1] + temp[..., i]
    return sec_deriv