simple_functional

odl.solvers.functional.functional.simple_functional(space, fcall=None, grad=None, prox=None, grad_lip=nan, convex_conj_fcall=None, convex_conj_grad=None, convex_conj_prox=None, convex_conj_grad_lip=nan, linear=False)[source]

Simplified interface to create a functional with specific properties.

Users may specify as many properties as-is needed by the application.

Parameters
spaceLinearSpace

Space that the functional should act on.

fcallcallable, optional

Function to evaluate when calling the functional.

gradcallable or Operator, optional

Gradient operator of the functional.

proxproximal factory, optional

Proximal factory for the functional.

grad_lipfloat, optional

lipschitz constant of the functional.

convex_conj_fcallcallable, optional

Function to evaluate when calling the convex conjugate functional.

convex_conj_gradcallable or Operator, optional

Gradient operator of the convex conjugate functional

convex_conj_proxproximal factory, optional

Proximal factory for the convex conjugate functional.

convex_conj_grad_lipfloat, optional

lipschitz constant of the convex conjugate functional.

linearbool, optional

True if the operator is linear.

Examples

Create squared sum functional on rn:

>>> def f(x):
...     return sum(xi**2 for xi in x)
>>> def dfdx(x):
...     return 2 * x
>>> space = odl.rn(3)
>>> func = simple_functional(space, f, grad=dfdx)
>>> func.domain
rn(3)
>>> func.range
RealNumbers()
>>> func([1, 2, 3])
14.0
>>> func.gradient([1, 2, 3])
rn(3).element([ 2.,  4.,  6.])