Mercurial > hg > octave-lyh
changeset 14822:93e5ade3fda4
Improve matlab compatibility of gmres
* scripts/sparse/gmres.m: adapt resvec, iter and relres outputs
to be more compatible with matlab
author | Carlo de Falco <cdf@users.sourceforge.net> |
---|---|
date | Sun, 01 Jul 2012 13:10:50 +0200 |
parents | aad7d7ee8e8a |
children | e437bacb3ef6 |
files | scripts/sparse/gmres.m |
diffstat | 1 files changed, 2 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/sparse/gmres.m +++ b/scripts/sparse/gmres.m @@ -174,7 +174,7 @@ x = x_old + V(:, 1:restart_it) * Y(1:restart_it); - resvec(iter) = presn; + resvec(iter+1) = presn; if (norm (x - x_old, inf) <= eps) flag = 3; # Stagnation: no change between iterations break; @@ -191,8 +191,7 @@ flag = 0; # Converged to solution within tolerance endif - resvec = resvec(1:iter-1); - it = [ceil(iter / restart), rem(iter, restart)]; + it = [floor(iter/restart), restart_it-1]; endif endfunction