IndicatorZero

class odl.functionals.default_functionals.IndicatorZero(*args, **kwargs)[source]

Bases: Functional

The indicator function of the singleton set {0}.

The function has a constant value if the input is zero, otherwise infinity.

__init__(space, constant=0)[source]

Initialize a new instance.

Parameters

spaceLinearSpace

Domain of the functional.

constantelement in domain.field, optional

The constant value of the functional

Examples

>>> space = odl.rn(3)
>>> func = IndicatorZero(space)
>>> func([0, 0, 0])
0
>>> func([0, 0, 1])
inf
>>> func = IndicatorZero(space, constant=2)
>>> func([0, 0, 0])
2