Skip to content

pcg

sparse · scripts/sparse/pcg.m

x = pcg (A, b, tol, maxit, M1, M2, x0)
[x, flag, relres, iter, resvec] = pcg (...)

Preconditioned conjugate gradients for A*x = b with A symmetric (Hermitian)
positive definite.  A is a matrix or a function handle returning A*x; the
preconditioner is M = M1*M2 (matrices or handles returning M\x).
flag: 0 converged, 1 maxit reached, 2 preconditioner failure,
3 stagnation, 4 breakdown (including a matrix that is not positive
definite).