xspline.xfunction#

class xspline.xfunction.XFunction(fun)[source]#

Bases: object

Function interface that provide easy access to function value, derivatives and definite integrals.

Parameters:
  • fun (Callable) – Function implementation.

  • TODO (describe the interface of the function implementation) –

append(other, sep)[source]#

Splice with another instance of XFunction to create a new XFunction.

Parameters:
  • other (XFunction) – Another XFunction after the current function.

  • sep (tuple[float, bool]) – The boundary point to separate two functions, before is the current function and after the the other function.

Return type:

XFunction

class xspline.xfunction.BundleXFunction(params, val_fun, der_fun, int_fun)[source]#

Bases: XFunction

This is one implementation of the XFunction, it takes the value, derivative and definite integral function and bundle them together as a XFunction.

Parameters:
  • params (tuple) – This is the parameters that is needed for the value, derivatives and the definitely integral function.

  • val_fun (RawVFunction) – Value function.

  • der_fun (RawDFunction) – Derviative function.

  • int_fun (RawIFunction) – Defintie integral function.

class xspline.xfunction.BasisXFunction(basis_funs, coef=None)[source]#

Bases: XFunction

This is one implementation of XFunction by taking in a set of instances of XFunction as basis functions. And the linear combination coefficients to provide function value, derivative and definite integral.

Parameters:
  • basis_funs (tuple[XFunction, ...]) – A set of instances of XFunction as basis functions.

  • coef (NDArray | None) – Coefficients for the linearly combine the basis functions.

property coef#

attrgetter(attr, …) –> attrgetter object

Return a callable object that fetches the given attribute(s) from its operand. After f = attrgetter(‘name’), the call f(r) returns r.name. After g = attrgetter(‘name’, ‘date’), the call g(r) returns (r.name, r.date). After h = attrgetter(‘name.first’, ‘name.last’), the call h(r) returns (r.name.first, r.name.last).

get_design_mat(x, order=0, check_args=True)[source]#

Provide design matrix from the set of basis functions.

Parameters:
  • x (NDArray) – Data points

  • order (int) – Order of differentiation/integration.

  • check_args (bool) – If True it will check and parse the arguments.

Returns:

Design matrix with dimention number of data points by number of basis functions.

Return type:

describe