xspline.indi#
- xspline.indi.indi_val(params, x)[source]#
Indicator value function,
- Parameters:
params (tuple[tuple[float, bool], tuple[float, bool]]) – Indicator parameters as a tuple consists of lower and upper bound of the interval corresponding to the indicator function.
x (ndarray[Any, dtype[_ScalarType_co]]) – Data points.
- Returns:
Indicator function value.
- Return type:
describe
- xspline.indi.indi_der(params, x, order)[source]#
Indicator derivative function. Since indicator function is a piecewise constant function, its derivative will always be zero.
- Parameters:
params (tuple[tuple[float, bool], tuple[float, bool]]) – Indicator parameters as a tuple consists of lower and upper bound of the interval corresponding to the indicator function.
x (ndarray[Any, dtype[_ScalarType_co]]) – Data points.
order (int) –
- Returns:
Indicator deviative value.
- Return type:
describe
- xspline.indi.indi_int(params, x, order)[source]#
Indicator definite integral function. It is a piecewise polynomial function.
- Parameters:
params (tuple[tuple[float, bool], tuple[float, bool]]) – Indicator parameters as a tuple consists of lower and upper bound of the interval corresponding to the indicator function.
x (ndarray[Any, dtype[_ScalarType_co]]) – Data points.
order (int) –
- Returns:
Indicator definite integral value.
- Return type:
describe
- class xspline.indi.Indi(params)[source]#
Bases:
BundleXFunction
Indicator function.
- Parameters:
params (tuple[tuple[float, bool], tuple[float, bool]]) – This is a tuple contains the lower and upper bounds of the indicator function. For each bound it consists of a number for the location of the bound and a boolean for the inclusion of the bound. For example, if we pass in ((0.0, True), (1.0, False)), this represents interval [0, 1).
Example
>>> indi = Indi(((0.0, True), (1.0, False))) >>> indi([-1.0, 0.0, 1.0]) array([0., 1., 0.]) >>> indi([-1.0, 0.0, 1.0], order=1) array([0., 0., 0.]) >>> indi([-1.0, 0.0, 1.0], order=-1) array([0., 0., 1.])