# HG changeset patch # User Carlo de Falco # Date 1341141050 -7200 # Node ID 93e5ade3fda43a14aef811a3224a4086cd41a162 # Parent aad7d7ee8e8adf16939532227d94e6ad12e7cfa6 Improve matlab compatibility of gmres * scripts/sparse/gmres.m: adapt resvec, iter and relres outputs to be more compatible with matlab diff --git a/scripts/sparse/gmres.m b/scripts/sparse/gmres.m --- 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