cgm(A,b)

Solves Ax=b using the conjugate gradient method.

You are now following this Submission

Solves Ax=b using the conjugate gradient method. The matrix A should be symmetric and positive definite.
Usage (examples provided at end of m-file):
x=cgm(A,b);

If the matrix is sparse, it is worth trying:
x=cgm(sparse(A),b);

Cite As

Mark Holmes (2026). cgm(A,b) (https://nl.mathworks.com/matlabcentral/fileexchange/56208-cgm-a-b), MATLAB Central File Exchange. Retrieved .

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.1.0.0

mostly modified the comments; the CGM code is unchanged

1.0.0.0