comparison scripts/sparse/gmres.m @ 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 5c269b73f467
children 5d3a684236b0
comparison
equal deleted inserted replaced
14821:aad7d7ee8e8a 14822:93e5ade3fda4
172 172
173 presn = norm (little_res, 2); 173 presn = norm (little_res, 2);
174 174
175 x = x_old + V(:, 1:restart_it) * Y(1:restart_it); 175 x = x_old + V(:, 1:restart_it) * Y(1:restart_it);
176 176
177 resvec(iter) = presn; 177 resvec(iter+1) = presn;
178 if (norm (x - x_old, inf) <= eps) 178 if (norm (x - x_old, inf) <= eps)
179 flag = 3; # Stagnation: no change between iterations 179 flag = 3; # Stagnation: no change between iterations
180 break; 180 break;
181 endif 181 endif
182 182
189 relres = presn / prec_b_norm; 189 relres = presn / prec_b_norm;
190 if (relres <= rtol) 190 if (relres <= rtol)
191 flag = 0; # Converged to solution within tolerance 191 flag = 0; # Converged to solution within tolerance
192 endif 192 endif
193 193
194 resvec = resvec(1:iter-1); 194 it = [floor(iter/restart), restart_it-1];
195 it = [ceil(iter / restart), rem(iter, restart)];
196 endif 195 endif
197 196
198 endfunction 197 endfunction
199 198
200 199