class_docstr: PCHIP 1-D monotonic cubic interpolation.
  
  ``x`` and ``y`` are arrays of values used to approximate some function f,
  with ``y = f(x)``. The interpolant uses monotonic cubic splines
  to find the value of new points. (PCHIP stands for Piecewise Cubic
  Hermite Interpolating Polynomial).
  
  Parameters
  ----------
  x : ndarray
      A 1-D array of monotonically increasing real values. ``x`` cannot
      include duplicate values (otherwise f is overspecified)
  y : ndarray
      A 1-D array of real values. ``y``'s length along the interpolation
      axis must be equal to the length of ``x``. If N-D array, use ``axis``
      parameter to select correct axis.
  axis : int, optional
      Axis in the y array corresponding to the x-coordinate values.
  extrapolate : bool, optional
      Whether to extrapolate to out-of-bounds points based on first
      and last intervals, or to return NaNs.
  
  See Also
  --------
  CubicHermiteSpline : Piecewise-cubic interpolator.
  Akima1DInterpolator : Akima 1D interpolator.
  PPoly : Piecewise polynomial in terms of coefficients and breakpoints.
  
  Notes
  -----
  The interpolator preserves monotonicity in the interpolation data and does
  not overshoot if the data is not smooth.
  
  The first derivatives are guaranteed to be continuous, but the second
  derivatives may jump at :math:`x_k`.
  
  Determines the derivatives at the points :math:`x_k`, :math:`f'_k`,
  by using PCHIP algorithm [1]_.
  
  Let :math:`h_k = x_{k+1} - x_k`, and  :math:`d_k = (y_{k+1} - y_k) / h_k`
  are the slopes at internal points :math:`x_k`.
  If the signs of :math:`d_k` and :math:`d_{k-1}` are different or either of
  them equals zero, then :math:`f'_k = 0`. Otherwise, it is given by the
  weighted harmonic mean
  
  .. math::
  
      \frac{w_1 + w_2}{f'_k} = \frac{w_1}{d_{k-1}} + \frac{w_2}{d_k}
  
  where :math:`w_1 = 2 h_k + h_{k-1}` and :math:`w_2 = h_k + 2 h_{k-1}`.
  
  The end slopes are set using a one-sided scheme [2]_.
  
  
  References
  ----------
  .. [1] F. N. Fritsch and J. Butland,
         A method for constructing local
         monotone piecewise cubic interpolants,
         SIAM J. Sci. Comput., 5(2), 300-304 (1984).
         `10.1137/0905021 <https://doi.org/10.1137/0905021>`_.
  .. [2] see, e.g., C. Moler, Numerical Computing with Matlab, 2004.
         `10.1137/1.9780898717952 <https://doi.org/10.1137/1.9780898717952>`_
class_docstr_tok: ["PCHIP","1-D","monotonic","cubic","interpolation",".","``","x","``","and","``","y","``","are","arrays","of","values","used","to","approximate","some","function","f",",","with","``","y","=","f","(","x",")","``",".","The","interpolant","uses","monotonic","cubic","splines","to","find","the","value","of","new","points",".","(","PCHIP","stands","for","Piecewise","Cubic","Hermite","Interpolating","Polynomial",")",".","Parameters","--","--","--","--","--","x",":","ndarray","A","1-D","array","of","monotonically","increasing","real","values",".","``","x","``","can","not","include","duplicate","values","(","otherwise","f","is","overspecified",")","y",":","ndarray","A","1-D","array","of","real","values",".","``","y","``","'s","length","along","the","interpolation","axis","must","be","equal","to","the","length","of","``","x","``",".","If","N-D","array",",","use","``","axis","``","parameter","to","select","correct","axis",".","axis",":","int",",","optional","Axis","in","the","y","array","corresponding","to","the","x-coordinate","values",".","extrapolate",":","bool",",","optional","Whether","to","extrapolate","to","out-of-bounds","points","based","on","first","and","last","intervals",",","or","to","return","NaNs",".","See","Also","--","--","--","--","CubicHermiteSpline",":","Piecewise-cubic","interpolator",".","Akima1DInterpolator",":","Akima","1D","interpolator",".","PPoly",":","Piecewise","polynomial","in","terms","of","coefficients","and","breakpoints",".","Notes","--","--","-","The","interpolator","preserves","monotonicity","in","the","interpolation","data","and","does","not","overshoot","if","the","data","is","not","smooth",".","The","first","derivatives","are","guaranteed","to","be","continuous",",","but","the","second","derivatives","may","jump","at",":","math",":","`","x_k","`",".","Determines","the","derivatives","at","the","points",":","math",":","`","x_k","`",",",":","math",":","`","f'_k","`",",","by","using","PCHIP","algorithm","[","1","]","_",".","Let",":","math",":","`","h_k","=","x_","{","k+1","}","-","x_k","`",",","and",":","math",":","`","d_k","=","(","y_","{","k+1","}","-","y_k",")","\/","h_k","`","are","the","slopes","at","internal","points",":","math",":","`","x_k","`",".","If","the","signs","of",":","math",":","`","d_k","`","and",":","math",":","`","d_","{","k-1","}","`","are","different","or","either","of","them","equals","zero",",","then",":","math",":","`","f'_k","=","0","`",".","Otherwise",",","it","is","given","by","the","weighted","harmonic","mean","..","math",":",":","\\frac","{","w_1","+","w_2","}","{","f'_k","}","=","\\frac","{","w_1","}","{","d_","{","k-1","}","}","+","\\frac","{","w_2","}","{","d_k","}","where",":","math",":","`","w_1","=","2","h_k","+","h_","{","k-1","}","`","and",":","math",":","`","w_2","=","h_k","+","2","h_","{","k-1","}","`",".","The","end","slopes","are","set","using","a","one-sided","scheme","[","2","]","_.","References","--","--","--","--","--","..","[","1","]","F.","N.","Fritsch","and","J.","Butland",",","A","method","for","constructing","local","monotone","piecewise","cubic","interpolants",",","SIAM","J.","Sci",".","Comput.",",","5","(","2",")",",","300-304","(","1984",")",".","`","10.1137\/0905021","<","https",":","\/\/doi.org\/10.1137\/0905021",">","`","_",".","..","[","2","]","see",",","e.g.",",","C.","Moler",",","Numerical","Computing","with","Matlab",",","2004",".","`","10.1137\/1.9780898717952","<","https",":","\/\/doi.org\/10.1137\/1.9780898717952",">","`","_"]
code: def __init__(self, x, y, axis=0, extrapolate=None):
      x, _, y, axis, _ = prepare_input(x, y, axis)
      xp = x.reshape((x.shape[0],) + (1,) * (y.ndim - 1))
      dk = self._find_derivatives(xp, y)
      super().__init__(x, y, dk, axis=0, extrapolate=extrapolate)
      self.axis = axis
  
file_path: cupy/cupyx/scipy/interpolate/_cubic.py
imports: import cupy
  from cupyx.scipy.interpolate._interpolate import PPoly
label_desc: Use image node_id 1 to create a new PchipInterpolator object from inherited base classes: CubicHermiteSpline with example: obj = PchipInterpolator(x, y, axis, extrapolate)