pylops.optimization.solver.cg¶
-
pylops.optimization.solver.
cg
(Op, y, x0, niter=10, damp=0.0, tol=0.0001, show=False, callback=None)[source]¶ Conjugate gradient
Solve a square system of equations given an operator
Op
and datay
using conjugate gradient iterations.Parameters: - Op :
pylops.LinearOperator
Operator to invert of size \([N \times N]\)
- y :
np.ndarray
Data of size \([N \times 1]\)
- x0 :
np.ndarray
, optional Initial guess
- niter :
int
, optional Number of iterations
- damp :
float
, optional Deprecated, will be removed in v2.0.0
- tol :
float
, optional Tolerance on residual norm
- show :
bool
, optional Display iterations log
- callback :
callable
, optional Function with signature (
callback(x)
) to call after each iteration wherex
is the current model vector
Returns: - x :
np.ndarray
Estimated model of size \([N \times 1]\)
- iit :
int
Number of executed iterations
- cost :
numpy.ndarray
, optional History of the L2 norm of the residual
Notes
Solve the \(\mathbf{y} = \mathbf{Opx}\) problem using conjugate gradient iterations.
- Op :