pylops.optimization.cls_leastsquares.PreconditionedInversion

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

Preconditioned inversion.

Solve a system of preconditioned equations given the operator Op and a preconditioner P.

Parameters:
Op : pylops.LinearOperator

Operator to invert of size \([N \times M]\).

See also

RegularizedInversion
Regularized inversion
NormalEquationsInversion
Normal equations inversion

Notes

Solve the following system of preconditioned equations given the operator \(\mathbf{Op}\), a preconditioner \(\mathbf{P}\), the data \(\mathbf{y}\)

\[\mathbf{y} = \mathbf{Op}\,\mathbf{P} \mathbf{p}\]

where \(\mathbf{p}\) is the solution in the preconditioned space and \(\mathbf{x} = \mathbf{P}\mathbf{p}\) is the solution in the original space.

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, P[, show]) Setup solver
solve(y, P[, x0, engine, show]) Run entire solver
step() Run one step of solver
setup(y, P, show=False)[source]

Setup solver

Parameters:
y : np.ndarray

Data of size \([N \times 1]\)

P : pylops.LinearOperator

Preconditioner

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)

Returns:
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, P, x0=None, engine='scipy', show=False, **kwargs_solver)[source]

Run entire solver

Parameters:
y : np.ndarray

Data of size \([N \times 1]\)

P : pylops.LinearOperator

Preconditioner

x0 : np.ndarray, optional

Initial guess of size \([M \times 1]\). If None, initialize internally as zero vector

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)

Returns:
x : 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\)