LineSearchFromIterNum

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

Bases: LineSearch

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

The returned step length is func(iter_count).

Methods

__call__(x, direction, dir_derivative)

Calculate the step length at a point.

__init__(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)