% rutero test 1, tema 6, S2-2013

n = 100;
A = diag(n^2*ones(n,1));
v = 1:n;
A(:,n) = v';
A(n,:) = v;

b = ones(n,1);

[ind,xmd,relresmd] = maxdescenso(A,b,1e-6,100);
[xgc,fgc,relres,itscg] = pcg(A,b,1e-6,100);

c = cond(A)

norm(xgc-xmd)

resmd = norm(b-A*xmd)/norm(b)

resgc = norm(b-A*xgc)/norm(b)

c*resmd

c*resgc
