Conjugate Gradient Method

Version 1.3.0.0 (1,49 ko) par Yi Cao
Conjugate Gradient Method to solve a system of linear equations
14,3K téléchargements
Mise à jour 6 fév. 2014

Afficher la licence

The conjugate gradient method aims to solve a system of linear equations, Ax=b, where A is symmetric, without calculation of the inverse of A. It only requires a very small amount of membory, hence is particularly suitable for large scale systems.

It is faster than other approach such as Gaussian elimination if A is well-conditioned. For example,

n=1000;
[U,S,V]=svd(randn(n));
s=diag(S);
A=U*diag(s+max(s))*U'; % to make A symmetric, well-contioned
b=randn(1000,1);
tic,x=conjgrad(A,b);toc
tic,x1=A\b;toc
norm(x-x1)
norm(x-A*b)

Conjugate gradient is about two to three times faster than A\b, which uses the Gaissian elimination.

Citation pour cette source

Yi Cao (2024). Conjugate Gradient Method (https://www.mathworks.com/matlabcentral/fileexchange/22494-conjugate-gradient-method), MATLAB Central File Exchange. Récupéré le .

Compatibilité avec les versions de MATLAB
Créé avec R2013b
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux
Catégories
En savoir plus sur Systems of Linear Equations dans Help Center et MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Publié le Notes de version
1.3.0.0

To consider two trival cases.

1.2.0.0

change initial value to x=b. slightly faster.

1.1.0.0

update description

1.0.0.0