class pylops.optimization.basesolver.Solver(Op, callbacks=None)[source]

This is a template class which a user must subclass when implementing a new solver. This class comprises of the following mandatory methods:

  • __init__: initialization method to which the operator Op must be passed

  • setup: a method that is invoked to setup the solver, basically it will create anything required prior to applying a step of the solver

  • step: a method applying a single step of the solver

  • run: a method applying multiple steps of the solver

  • finalize: a method that is invoked at the end of the optimization process. It can be used to do some final clean-up of the properties of the operator that we want to expose to the user

  • solve: a method applying the entire optimization loop of the solver for a certain number of steps

and optional methods:

  • _print_solver: a method print on screen details of the solver (already implemented)

  • _print_setup: a method print on screen details of the setup process

  • _print_step: a method print on screen details of each step

  • _print_finalize: a method print on screen details of the finalize process

  • callback: a method implementing a callback function, which is called after every step of the solver


Operator to invert of


Callbacks object used to implement custom callbacks


__init__(Op[, callbacks])

callback(x, *args, **kwargs)

Callback routine

finalize(*args[, show])

Finalize solver

run(x, *args[, show])

Run multiple steps of solver

setup(y, *args[, show])

Setup solver

solve(y, *args[, show])


step(x, *args[, show])

Run one step of solver

Examples using pylops.optimization.basesolver.Solver

Linear Regression

Linear Regression

Linear Regression
03. Solvers (Advanced)

03. Solvers (Advanced)

03. Solvers (Advanced)