pylops.optimization.basesolver.Solver#
- 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 passedsetup
: a method that is invoked to setup the solver, basically it will create anything required prior to applying a step of the solverstep
: a method applying a single step of the solverrun
: a method applying multiple steps of the solverfinalize
: 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 usersolve
: 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 processcallback
: a method implementing a callback function, which is called after every step of the solver
- Parameters
- Op
pylops.LinearOperator
Operator to invert of
- callbacks
pylops.optimization.callback.Callbacks
Callbacks object used to implement custom callbacks
- Op
Methods
__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])Solve
step
(x, *args[, show])Run one step of solver