LineSearchFromIterNum

class odl.solvers.util.steplen.LineSearchFromIterNum(func)[source]

Bases: odl.solvers.util.steplen.LineSearch

Line search object that returns a step length from a function.

The returned step length is func(iter_count).

__init__(self, func)[source]

Initialize a new instance.

Parameters
funccallable

Function that when called with an iteration count should return the step length. The iteration count starts at 0.

Examples

Make a step size that is 1.0 for the first 5 iterations, then 0.1:

>>> def step_length(iter):
...     if iter < 5:
...         return 1.0
...     else:
...         return 0.1
>>> line_search = LineSearchFromIterNum(step_length)