class_docstr: Base class for piecewise polynomials.
class_docstr_tok: ["Base","class","for","piecewise","polynomials","."]
docstr: Add additional breakpoints and coefficients to the polynomial.
  
  Parameters
  ----------
  c : ndarray, size (k, m, ...)
      Additional coefficients for polynomials in intervals. Note that
      the first additional interval will be formed using one of the
      ``self.x`` end points.
  x : ndarray, size (m,)
      Additional breakpoints. Must be sorted in the same order as
      ``self.x`` and either to the right or to the left of the current
      breakpoints.
code: def extend(self, c, x):
      """
      Add additional breakpoints and coefficients to the polynomial.
  
      Parameters
      ----------
      c : ndarray, size (k, m, ...)
          Additional coefficients for polynomials in intervals. Note that
          the first additional interval will be formed using one of the
          ``self.x`` end points.
      x : ndarray, size (m,)
          Additional breakpoints. Must be sorted in the same order as
          ``self.x`` and either to the right or to the left of the current
          breakpoints.
      """
  
      c = cupy.asarray(c)
      x = cupy.asarray(x)
  
      if c.ndim < 2:
          raise ValueError("invalid dimensions for c")
      if x.ndim != 1:
          raise ValueError("invalid dimensions for x")
      if x.shape[0] != c.shape[1]:
          raise ValueError(
              "Shapes of x {} and c {} are incompatible".format(
                  x.shape, c.shape
              )
          )
      if c.shape[2:] != self.c.shape[2:] or c.ndim != self.c.ndim:
          raise ValueError(
              "Shapes of c {} and self.c {} are incompatible".format(
                  c.shape, self.c.shape
              )
          )
  
      if c.size == 0:
          return
  
      dx = cupy.diff(x)
      if not (cupy.all(dx >= 0) or cupy.all(dx <= 0)):
          raise ValueError("`x` is not sorted.")
  
      if self.x[-1] >= self.x[0]:
          if not x[-1] >= x[0]:
              raise ValueError(
                  "`x` is in the different order " "than `self.x`."
              )
  
          if x[0] >= self.x[-1]:
              action = "append"
          elif x[-1] <= self.x[0]:
              action = "prepend"
          else:
              raise ValueError(
                  "`x` is neither on the left or on the right "
                  "from `self.x`."
              )
      else:
          if not x[-1] <= x[0]:
              raise ValueError(
                  "`x` is in the different order " "than `self.x`."
              )
  
          if x[0] <= self.x[-1]:
              action = "append"
          elif x[-1] >= self.x[0]:
              action = "prepend"
          else:
              raise ValueError(
                  "`x` is neither on the left or on the right "
                  "from `self.x`."
              )
  
      dtype = self._get_dtype(c.dtype)
  
      k2 = max(c.shape[0], self.c.shape[0])
      c2 = cupy.zeros(
          (k2, self.c.shape[1] + c.shape[1]) + self.c.shape[2:],
          dtype=dtype,
      )
  
      if action == "append":
          c2[k2 - self.c.shape[0] :, : self.c.shape[1]] = self.c
          c2[k2 - c.shape[0] :, self.c.shape[1] :] = c
          self.x = cupy.r_[self.x, x]
      elif action == "prepend":
          c2[k2 - self.c.shape[0] :, : c.shape[1]] = c
          c2[k2 - c.shape[0] :, c.shape[1] :] = self.c
          self.x = cupy.r_[x, self.x]
  
      self.c = c2
  
imports: import math
  import cupy
  from cupy._core import internal
  from cupy._core._scalar import get_typename
  from cupy_backends.cuda.api import runtime
  from cupyx.scipy import special
  from cupyx.scipy.interpolate._bspline import BSpline, _get_dtype
  import numpy
label_desc: Use image node_id 5 for calling the _PPolyBase obj's underlying member method code with example usage: obj.extend(c, x) without return types