# pylops.optimization.cls_leastsquares.RegularizedInversion¶

class pylops.optimization.cls_leastsquares.RegularizedInversion(Op, callbacks=None)[source]

Regularized inversion.

Solve a system of regularized equations given the operator Op, a data weighting operator Weight, and a list of regularization terms Regs.

Parameters: Op : pylops.LinearOperator Operator to invert of size $$[N \times M]$$.

RegularizedOperator
Regularized operator
NormalEquationsInversion
Normal equations inversion
PreconditionedInversion
Preconditioned inversion

Notes

Solve the following system of regularized equations given the operator $$\mathbf{Op}$$, a data weighting operator $$\mathbf{W}^{1/2}$$, a list of regularization terms $$\mathbf{R}_i$$, the data $$\mathbf{y}$$ and regularization data $$\mathbf{y}_{\mathbf{R}_i}$$, and the damping factors $$\epsilon_\mathbf{I}$$: and $$\epsilon_{\mathbf{R}_i}$$:

$\begin{split}\begin{bmatrix} \mathbf{W}^{1/2} \mathbf{Op} \\ \epsilon_{\mathbf{R}_1} \mathbf{R}_1 \\ \vdots \\ \epsilon_{\mathbf{R}_N} \mathbf{R}_N \end{bmatrix} \mathbf{x} = \begin{bmatrix} \mathbf{W}^{1/2} \mathbf{y} \\ \epsilon_{\mathbf{R}_1} \mathbf{y}_{\mathbf{R}_1} \\ \vdots \\ \epsilon_{\mathbf{R}_N} \mathbf{y}_{\mathbf{R}_N} \\ \end{bmatrix}\end{split}$

where the Weight provided here is equivalent to the square-root of the weight in pylops.optimization.leastsquares.NormalEquationsInversion. Note that this system is solved using the scipy.sparse.linalg.lsqr and an initial guess x0 can be provided to this solver, despite the original solver does not allow so.

Methods

 __init__(Op[, callbacks]) Initialize self. callback(x, *args, **kwargs) Callback routine finalize(*args[, show]) Finalize solver run(x[, engine, show]) Run solver setup(y, Regs[, Weight, dataregs, epsRs, show]) Setup solver solve(y, Regs[, x0, Weight, dataregs, …]) Run entire solver step() Run one step of solver
setup(y, Regs, Weight=None, dataregs=None, epsRs=None, show=False)[source]

Setup solver

Parameters: y : np.ndarray Data of size $$[N \times 1]$$ Regs : list Regularization operators (None to avoid adding regularization) Weight : pylops.LinearOperator, optional Weight operator dataregs : list, optional Regularization data (must have the same number of elements as Regs) epsRs : list, optional Regularization dampings (must have the same number of elements as Regs) show : bool, optional Display setup log
step()[source]

Run one step of solver

This method is used to run one step of the solver. Users can change the function signature by including any other input parameter required when applying one step of the solver

Parameters: x : np.ndarray Current model vector to be updated by a step of the solver show : bool, optional Display step log
run(x, engine='scipy', show=False, **kwargs_solver)[source]

Run solver

Parameters: x : np.ndarray Current model vector to be updated by multiple steps of the solver. If None, x is assumed to be a zero vector engine : str, optional Solver to use (scipy or pylops) show : bool, optional Display iterations log **kwargs_solver Arbitrary keyword arguments for chosen solver (scipy.sparse.linalg.lsqr and pylops.optimization.solver.cgls are used for engine scipy and pylops, respectively) xinv : numpy.ndarray Inverted model. istop : int Gives the reason for termination 1 means $$\mathbf{x}$$ is an approximate solution to $$\mathbf{y} = \mathbf{Op}\,\mathbf{x}$$ 2 means $$\mathbf{x}$$ approximately solves the least-squares problem itn : int Iteration number upon termination r1norm : float $$||\mathbf{r}||_2^2$$, where $$\mathbf{r} = \mathbf{y} - \mathbf{Op}\,\mathbf{x}$$ r2norm : float $$\sqrt{\mathbf{r}^T\mathbf{r} + \epsilon^2 \mathbf{x}^T\mathbf{x}}$$. Equal to r1norm if $$\epsilon=0$$
solve(y, Regs, x0=None, Weight=None, dataregs=None, epsRs=None, engine='scipy', show=False, **kwargs_solver)[source]

Run entire solver

Parameters: y : np.ndarray Data of size $$[N \times 1]$$ Regs : list Regularization operators (None to avoid adding regularization) x0 : numpy.ndarray, optional Initial guess Weight : pylops.LinearOperator, optional Weight operator dataregs : list, optional Regularization data (must have the same number of elements as Regs) epsRs : list, optional Regularization dampings (must have the same number of elements as Regs) engine : str, optional Solver to use (scipy or pylops) show : bool, optional Display log **kwargs_solver Arbitrary keyword arguments for chosen solver (scipy.sparse.linalg.lsqr and pylops.optimization.solver.cgls are used for engine scipy and pylops, respectively) xinv : numpy.ndarray Inverted model. istop : int Gives the reason for termination 1 means $$\mathbf{x}$$ is an approximate solution to $$\mathbf{y} = \mathbf{Op}\,\mathbf{x}$$ 2 means $$\mathbf{x}$$ approximately solves the least-squares problem itn : int Iteration number upon termination r1norm : float $$||\mathbf{r}||_2^2$$, where $$\mathbf{r} = \mathbf{y} - \mathbf{Op}\,\mathbf{x}$$ r2norm : float $$\sqrt{\mathbf{r}^T\mathbf{r} + \epsilon^2 \mathbf{x}^T\mathbf{x}}$$. Equal to r1norm if $$\epsilon=0$$