% % ITIMP % % This command script simulates a single iteration of the iterative % improvement (refinement) method of error estimation, applied to the % system of equations: % % A x = b % % and in a simulated,specified digit (rounding) machine. The script % has no calling arguments, however the variables % % A = the (square) matrix % b = the right-hand side (column) vector % NDIGITS = the number of simulated digits of precision % x = the current (approximate) computed solution % niter = the number of iterations already completed % [ L U P ] = the output of the lu_chop( A , NDIGITS ) , % command, i.e. the permutation (P), lower (L) % and upper (L) triangular matrices such that % % PA = LU % % must be defined prior to invoking the script. Note that A , P, L , U % and NDIGITS must be upper case, and b , x , and niter lower!!! % % On exit, the resulting updated solution vector, i.e. % % x + e % % where e is the (computed) error estimate from the iterative % refinement algorithm, is found. along with the iteration number, % in the last row of the array named data , specifically % % data = [ data ; niter (x + e)' ] % % r = calc_resid_chop( A, b, x , 2*NDIGITS ) ; % z = fwd_solve_chop( L , P*r ) ; e = bwd_solve_chop( U , z ) ; % niter = niter + 1 ; % x = chop( x + e, NDIGITS) ; data = [ data ; niter x' ] ;