class_docstr: Piecewise polynomial in terms of coefficients and breakpoints.
  
  The polynomial between ``x[i]`` and ``x[i + 1]`` is written in the
  
  Bernstein polynomial basis::
  
      S = sum(c[a, i] * b(a, k; x) for a in range(k+1)),
  
  where ``k`` is the degree of the polynomial, and::
  
      b(a, k; x) = binom(k, a) * t**a * (1 - t)**(k - a),
  
  with ``t = (x - x[i]) / (x[i+1] - x[i])`` and ``binom`` is the binomial
  coefficient.
  
  Parameters
  ----------
  c : ndarray, shape (k, m, ...)
      Polynomial coefficients, order `k` and `m` intervals
  x : ndarray, shape (m+1,)
      Polynomial breakpoints. Must be sorted in either increasing or
      decreasing order.
  extrapolate : bool, optional
      If bool, determines whether to extrapolate to out-of-bounds points
      based on first and last intervals, or to return NaNs. If 'periodic',
      periodic extrapolation is used. Default is True.
  axis : int, optional
      Interpolation axis. Default is zero.
  
  Attributes
  ----------
  x : ndarray
      Breakpoints.
  c : ndarray
      Coefficients of the polynomials. They are reshaped
      to a 3-D array with the last dimension representing
      the trailing dimensions of the original coefficient array.
  axis : int
      Interpolation axis.
  
  See also
  --------
  PPoly : piecewise polynomials in the power basis
  
  Notes
  -----
  Properties of Bernstein polynomials are well documented in the literature,
  see for example [1]_ [2]_ [3]_.
  
  References
  ----------
  .. [1] https://en.wikipedia.org/wiki/Bernstein_polynomial
  .. [2] Kenneth I. Joy, Bernstein polynomials,
     http://www.idav.ucdavis.edu/education/CAGDNotes/Bernstein-Polynomials.pdf
  .. [3] E. H. Doha, A. H. Bhrawy, and M. A. Saker, Boundary Value Problems,
         vol 2011, article ID 829546,
         `10.1155/2011/829543 <https://doi.org/10.1155/2011/829543>`_.
  
  Examples
  --------
  >>> from cupyx.scipy.interpolate import BPoly
  >>> x = [0, 1]
  >>> c = [[1], [2], [3]]
  >>> bp = BPoly(c, x)
  
  This creates a 2nd order polynomial
  
  .. math::
  
      B(x) = 1 \times b_{0, 2}(x) + 2 \times b_{1, 2}(x) +
             3 \times b_{2, 2}(x) \\
           = 1 \times (1-x)^2 + 2 \times 2 x (1 - x) + 3 \times x^2
class_docstr_tok: ["Piecewise","polynomial","in","terms","of","coefficients","and","breakpoints",".","The","polynomial","between","``","x","[","i","]","``","and","``","x","[","i","+","1","]","``","is","written","in","the","Bernstein","polynomial","basis",":",":","S","=","sum","(","c","[","a",",","i","]","*","b","(","a",",","k",";","x",")","for","a","in","range","(","k+1",")",")",",","where","``","k","``","is","the","degree","of","the","polynomial",",","and",":",":","b","(","a",",","k",";","x",")","=","binom","(","k",",","a",")","*","t","*","*","a","*","(","1","-","t",")","*","*","(","k","-","a",")",",","with","``","t","=","(","x","-","x","[","i","]",")","\/","(","x","[","i+1","]","-","x","[","i","]",")","``","and","``","binom","``","is","the","binomial","coefficient",".","Parameters","--","--","--","--","--","c",":","ndarray",",","shape","(","k",",","m",",","...",")","Polynomial","coefficients",",","order","`","k","`","and","`","m","`","intervals","x",":","ndarray",",","shape","(","m+1",",",")","Polynomial","breakpoints",".","Must","be","sorted","in","either","increasing","or","decreasing","order",".","extrapolate",":","bool",",","optional","If","bool",",","determines","whether","to","extrapolate","to","out-of-bounds","points","based","on","first","and","last","intervals",",","or","to","return","NaNs",".","If","'periodic","'",",","periodic","extrapolation","is","used",".","Default","is","True",".","axis",":","int",",","optional","Interpolation","axis",".","Default","is","zero",".","Attributes","--","--","--","--","--","x",":","ndarray","Breakpoints",".","c",":","ndarray","Coefficients","of","the","polynomials",".","They","are","reshaped","to","a","3-D","array","with","the","last","dimension","representing","the","trailing","dimensions","of","the","original","coefficient","array",".","axis",":","int","Interpolation","axis",".","See","also","--","--","--","--","PPoly",":","piecewise","polynomials","in","the","power","basis","Notes","--","--","-","Properties","of","Bernstein","polynomials","are","well","documented","in","the","literature",",","see","for","example","[","1","]","_","[","2","]","_","[","3","]","_.","References","--","--","--","--","--","..","[","1","]","https",":","\/\/en.wikipedia.org\/wiki\/Bernstein_polynomial","..","[","2","]","Kenneth","I.","Joy",",","Bernstein","polynomials",",","http",":","\/\/www.idav.ucdavis.edu\/education\/CAGDNotes\/Bernstein-Polynomials.pdf","..","[","3","]","E.","H.","Doha",",","A.","H.","Bhrawy",",","and","M.","A.","Saker",",","Boundary","Value","Problems",",","vol","2011",",","article","ID","829546",",","`","10.1155\/2011\/829543","<","https",":","\/\/doi.org\/10.1155\/2011\/829543",">","`","_",".","Examples","--","--","--","--",">",">",">","from","cupyx.scipy.interpolate","import","BPoly",">",">",">","x","=","[","0",",","1","]",">",">",">","c","=","[","[","1","]",",","[","2","]",",","[","3","]","]",">",">",">","bp","=","BPoly","(","c",",","x",")","This","creates","a","2nd","order","polynomial","..","math",":",":","B","(","x",")","=","1","\\times","b_","{","0",",","2","}","(","x",")","+","2","\\times","b_","{","1",",","2","}","(","x",")","+","3","\\times","b_","{","2",",","2","}","(","x",")","\\\\","=","1","\\times","(","1-x",")","^2","+","2","\\times","2","x","(","1","-","x",")","+","3","\\times","x^2"]
docstr: Raise a degree of a polynomial in the Bernstein basis.
  
  Given the coefficients of a polynomial degree `k`, return (the
  coefficients of) the equivalent polynomial of degree `k+d`.
  
  Parameters
  ----------
  c : array_like
      coefficient array, 1-D
  d : integer
  
  Returns
  -------
  array
      coefficient array, 1-D array of length `c.shape[0] + d`
  
  Notes
  -----
  This uses the fact that a Bernstein polynomial `b_{a, k}` can be
  identically represented as a linear combination of polynomials of
  a higher degree `k+d`:
  
      .. math:: b_{a, k} = comb(k, a) \sum_{j=0}^{d} b_{a+j, k+d} \
                           comb(d, j) / comb(k+d, a+j)
code: def _raise_degree(c, d):
      r"""
          Raise a degree of a polynomial in the Bernstein basis.
  
          Given the coefficients of a polynomial degree `k`, return (the
          coefficients of) the equivalent polynomial of degree `k+d`.
  
          Parameters
          ----------
          c : array_like
              coefficient array, 1-D
          d : integer
  
          Returns
          -------
          array
              coefficient array, 1-D array of length `c.shape[0] + d`
  
          Notes
          -----
          This uses the fact that a Bernstein polynomial `b_{a, k}` can be
          identically represented as a linear combination of polynomials of
          a higher degree `k+d`:
  
              .. math:: b_{a, k} = comb(k, a) \sum_{j=0}^{d} b_{a+j, k+d} \
                                   comb(d, j) / comb(k+d, a+j)
          """
      if d == 0:
          return c
  
      k = c.shape[0] - 1
      out = cupy.zeros((c.shape[0] + d,) + c.shape[1:], dtype=c.dtype)
  
      for a in range(c.shape[0]):
          f = c[a] * _comb(k, a)
          for j in range(d + 1):
              out[a + j] += f * _comb(d, j) / _comb(k + d, a + j)
      return out
  
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 6 for calling the BPoly obj's underlying member method code with example usage: obj._raise_degree(c, d) and returns: out, c