pylops_mpi.optimization.basic.cg#

pylops_mpi.optimization.basic.cg(Op, y, x0, niter=10, tol=0.0001, show=False, itershow=(10, 10, 10), callback=None)[source]#

Conjugate gradient

Solve a square system of equations given either an MPILinearOperator or an MPIStackedLinearOperator Op and distributed data y using conjugate gradient iterations.

Parameters:
Oppylops_mpi.MPILinearOperator or pylops_mpi.MPIStackedLinearOperator

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

ypylops_mpi.DistributedArray or pylops_mpi.StackedDistributedArray

DistributedArray of size (N,)

x0pylops_mpi.DistributedArray or pylops_mpi.StackedDistributedArray

Initial guess

niterint, optional

Number of iterations

tolfloat, optional

Tolerance on residual norm

showbool, optional

Display iterations log

itershowtuple, optional

Display set log for the first N1 steps, last N2 steps, and every N3 steps in between where N1, N2, N3 are the three element of the list.

callbackcallable, optional

Function with signature (callback(x)) to call after each iteration where x is the current model vector

Returns:
xpylops_mpi.DistributedArray or pylops_mpi.StackedDistributedArray

Estimated model of size (N,)

iitint

Number of executed iterations

costnumpy.ndarray, optional

History of the L2 norm of the residual

Notes

See pylops_mpi.optimization.cls_basic.CG

Examples using pylops_mpi.optimization.basic.cg#

Post Stack Inversion - 3D

Post Stack Inversion - 3D