function [x,residues] = CGall(A,b,x,tolerance) n=length(b); residues=zeros(n+1,1); P=zeros(n,n); r=b-A*x; residues(1,1)=r'*r; for i=1:n somme=zeros(n,1); for j=i-1:-1:1%projection sur toutes les anciennes directions pj=P(:,j); somme=somme+r'*A*pj/(pj'*A*pj)*pj; end p=r-somme; P(:,i)=p; alpha=p'*b/(p'*A*p); x=x+alpha*p; r=b-A*x; residues(i+1,1)=sqrt(r'*r); if(residues(i+1,1)