Back to Sparse Matrices
pcg
Preconditioned conjugate gradients
Syntax
x = pcg(A, b) [x, flag, relres, iter] = pcg(A, b, tol, maxit)
Description
Solves the symmetric positive definite linear system Ax = b using the Preconditioned Conjugate Gradient method.
Parameters
| Name | Description |
|---|---|
| A | Symmetric positive definite sparse matrix |
| b | Right-hand side vector |
| tol(optional) | Convergence tolerance (default 1e-6) |
| maxit(optional) | Maximum iterations |
Returns
Solution vector x, or [x, flag, relres, iter]
Examples
Try It
>> x = pcg(A, b)