pylops.optimization.cls_basic.CGLS¶
- class pylops.optimization.cls_basic.CGLS(Op, callbacks=None)[source]¶
Conjugate gradient least squares
Solve an overdetermined system of equations given an operator
Opand datayusing conjugate gradient iterations.- Parameters:
- Op
pylops.LinearOperator Operator to invert of size \([N \times M]\)
- Op
- Attributes:
- ncp
module Array module used by the solver (obtained via
pylops.utils.backend.get_array_module) ). Available only aftersetupis called.- isjax
bool True if the input data is a JAX array. Available only after
setupis called and updated at each call tostep.- s
numpy.ndarray Temporary vector of size \([N \times 1]\). Available only after
setupis called and updated at each call tostep.- c
numpy.ndarray Conjugate direction vector of size \([N \times 1]\). Available only after
setupis called and updated at each call tostep.- q
numpy.ndarray Temporary vector of size \([M \times 1]\). Available only after
setupis called and updated at each call tostep.- c1
numpy.ndarray Pre-allocated vector of size \([N \times 1]\) used in the solver when
preallocate=True. Available only aftersetupis called and updated at each call tostep.- x1
numpy.ndarray Pre-allocated vector of size \([M \times 1]\) used in the solver when
preallocate=True. Available only aftersetupis called and updated at each call tostep.- r
numpy.ndarray Residual vector of size \([N \times 1]\) used in the solver when
preallocate=True. Available only aftersetupis called and updated at each call tostep.- kold
float Squared norm of the residual at previous iteration. Available only after
setupis called and updated at each call tostep.- cost
list History of the L2 norm of the residual. Available only after
setupis called and updated at each call tostep.- cost1
list History of the L2 norm of the entire objective function (residual plus regularization). Available only after
setupis called and updated at each call tostep.- iiter
int Current iteration number. Available only after
setupis called and updated at each call tostep.
- ncp
Notes
Minimize the following functional using conjugate gradient iterations:
\[J = || \mathbf{y} - \mathbf{Op}\,\mathbf{x} ||_2^2 + \epsilon^2 || \mathbf{x} ||_2^2\]where \(\epsilon\) is the damping coefficient.
Methods
__init__(Op[, callbacks])callback(x, *args, **kwargs)Callback routine
finalize([show])Finalize solver
memory_usage([show, unit])Compute memory usage of the solver
run(x[, niter, show, itershow])Run solver
setup(y[, x0, niter, damp, tol, ...])Setup solver
solve(y[, x0, niter, damp, tol, ...])Run entire solver
step(x[, show])Run one step of solver