class_docstr: Bsplines of a given order and specified knots.
  
  Implementation is based on description in Chapter 5 of
  
  Hastie, Tibshirani and Friedman (2001). "The Elements of Statistical
  Learning." Springer-Verlag. 536 pages.
  
  
  INPUTS:
     knots  -- a sorted array of knots with knots[0] the lower boundary,
               knots[1] the upper boundary and knots[1:-1] the internal
               knots.
     order  -- order of the Bspline, default is 4 which yields cubic
               splines
     M      -- number of additional boundary knots, if None it defaults
               to order
     coef   -- an optional array of real-valued coefficients for the Bspline
               of shape (knots.shape + 2 * (M - 1) - order,).
     x      -- an optional set of x values at which to evaluate the
               Bspline to avoid extra evaluation in the __call__ method
class_docstr_tok: ["Bsplines","of","a","given","order","and","specified","knots",".","Implementation","is","based","on","description","in","Chapter","5","of","Hastie",",","Tibshirani","and","Friedman","(","2001",")",".","``","The","Elements","of","Statistical","Learning",".","''","Springer-Verlag",".","536","pages",".","INPUTS",":","knots","--","a","sorted","array","of","knots","with","knots","[","0","]","the","lower","boundary",",","knots","[","1","]","the","upper","boundary","and","knots","[","1",":","-1","]","the","internal","knots",".","order","--","order","of","the","Bspline",",","default","is","4","which","yields","cubic","splines","M","--","number","of","additional","boundary","knots",",","if","None","it","defaults","to","order","coef","--","an","optional","array","of","real-valued","coefficients","for","the","Bspline","of","shape","(","knots.shape","+","2","*","(","M","-","1",")","-","order",",",")",".","x","--","an","optional","set","of","x","values","at","which","to","evaluate","the","Bspline","to","avoid","extra","evaluation","in","the","__call__","method"]
docstr: Evaluate a particular basis element of the BSpline,
  or its derivative.
  
  INPUTS:
     x  -- x values at which to evaluate the basis element
     i  -- which element of the BSpline to return
     d  -- the order of derivative
  
  OUTPUTS: y
     y  -- value of d-th derivative of the i-th basis element
           of the BSpline at specified x values
docstr_tok: ["Evaluate","a","particular","basis","element","of","the","BSpline",",","or","its","derivative",".","INPUTS",":","x","--","x","values","at","which","to","evaluate","the","basis","element","i","--","which","element","of","the","BSpline","to","return","d","--","the","order","of","derivative","OUTPUTS",":","y","y","--","value","of","d-th","derivative","of","the","i-th","basis","element","of","the","BSpline","at","specified","x","values"]
code: def basis_element(self, x, i, d=0):
      """
      Evaluate a particular basis element of the BSpline,
      or its derivative.
  
      INPUTS:
         x  -- x values at which to evaluate the basis element
         i  -- which element of the BSpline to return
         d  -- the order of derivative
  
      OUTPUTS: y
         y  -- value of d-th derivative of the i-th basis element
               of the BSpline at specified x values
      """
  
      x = np.asarray(x, np.float64)
      _shape = x.shape
      if _shape == ():
          x.shape = (1,)
      x.shape = (np.product(_shape, axis=0),)
      if i < self.tau.shape[0] - 1:
          # TODO: OWNDATA flags...
          v = _hbspline.evaluate(x, self.tau, self.m, d, i, i + 1)
      else:
          return np.zeros(x.shape, np.float64)
  
      if i == self.tau.shape[0] - self.m:
          v = np.where(np.equal(x, self.tau[-1]), 1, v)
      v.shape = _shape
      return v
  
imports: import numpy
  import numpy.linalg
  from scipy.linalg import solveh_banded
  from scipy.optimize import golden
  from models import _hbspline
  import warnings
label_desc: Use image node_id 5 for calling the BSpline obj's underlying member method code with example usage: obj.basis_element(x, i, d) and returns: v, np