class sigpy.alg.Alg(max_iter)[source]

Abstraction for iterative algorithms.

The standard way of using an Alg object, say alg, is as follows:

>>> while not alg.done():
>>>     alg.update()

The user is free to run other things in the while loop. An Alg object is meant to run once. Once done, the object should not be run again.

When creating a new Alg class, the user should supply an _update() function to perform the iterative update, and optionally a _done() function to determine when to terminate the iteration. The default _done() function simply checks whether the number of iterations has reached the maximum.

The interface for each Alg class should not depend on Linop or Prox explicitly. For example, if the user wants to design an Alg class to accept a Linop, say A, as an argument, then it should also accept any function that can be called to compute x -> A(x). Similarly, to accept a Prox, say proxg, as an argument, the Alg class should accept any function that can be called to compute alpha, x -> proxg(x).

Parameters:max_iter (int) – Maximum number of iterations.

Maximum number of iterations.


Current iteration.


Initialize self. See help(type(self)) for accurate signature.


__init__(max_iter) Initialize self.
done() Return whether the algorithm is done.
update() Perform one update step.