- ott.math.fixed_point_loop.fixpoint_iter(cond_fn, body_fn, min_iterations, max_iterations, inner_iterations, constants, state)[source]#
Implementation of a fixed point loop.
This fixed point loop iterator applies body_fn to a tuple (iteration, constants, state, compute_error) to output a new state, using context provided in iteration and constants.
body_fn is iterated (inner_iterations -1) times, and one last time with the compute_error flag indicating that additional computational effort can be spent on recalculating the latest error (errors are stored as the first element of the state tuple).
upon termination of these inner_iterations, the loop is continued if iteration is smaller than min_iterations, stopped if equal/larger than max_iterations, and interrupted if cond_fn returns False.
bool]) – termination condition function
Any]) – body loop instructions
int) – lower bound on the total amount of fixed point iterations
int) – upper bound on the total amount of fixed point iterations
int) – number of iterations body_fn will be executed successively before calling cond_fn.
Any) – constant (during loop) parameters passed on to body
Any) – state variable
outputs state returned by body_fn upon termination.