pylops.optimization.cls_basic.CGยถ

class pylops.optimization.cls_basic.CG(Op, callbacks=None)[source]ยถ

Conjugate gradient

Solve a square system of equations given an operator Op and data y using conjugate gradient iterations.

Parameters:
Oppylops.LinearOperator

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

Attributes:
ncpmodule

Array module used by the solver (obtained via pylops.utils.backend.get_array_module) ). Available only after setup is called.

isjaxbool

True if the input data is a JAX array. Available only after setup is called and updated at each call to step.

rnumpy.ndarray

Residual vector of size \([N \times 1]\). Available only after setup is called and updated at each call to step.

cnumpy.ndarray

Conjugate direction vector of size \([N \times 1]\). Available only after setup is called and updated at each call to step.

c1numpy.ndarray

Pre-allocated vector of size \([N \times 1]\) used in the solver when preallocate=True. Available only after setup is called and updated at each call to step.

koldfloat

Squared norm of the residual at previous iteration. Available only after setup is called and updated at each call to step.

costlist

History of the L2 norm of the residual. Available only after setup is called and updated at each call to step.

iiterint

Current iteration number. Available only after setup is called and updated at each call to step.

Notes

Solve the \(\mathbf{y} = \mathbf{Op}\,\mathbf{x}\) problem using conjugate gradient iterations [1].

[1]

Hestenes, M R., Stiefel, E., โ€œMethods of Conjugate Gradients for Solving Linear Systemsโ€, Journal of Research of the National Bureau of Standards. vol. 49. 1952.

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, tol, preallocate, show])

Setup solver

solve(y[, x0, niter, tol, preallocate, ...])

Run entire solver

step(x[, show])

Run one step of solver