% Testing program test_x.m for a version of gmres_x.m organized as suggested by % R.J. Hanson and D.R. Kincaid,"Notes on GMRES Algorithm Organization", % Technical Report TR-05-05, March 2005, % Computer Sciences Department, University of Texas at Austin. % Date = 18 April 2005. disp ' Solve random problems with x = all ones as a solution' disp ' To start try sytem size of 30, 15 subdiagonals, and 10 GMRES iterations.' while 1 rand('state',0); disp ' ' n = input(' Enter system size here = '); % Create an n by n random matrix with a slight diagonal dominance. AA = rand(n,n); D = diag(AA); A = AA+diag(D+2*rand(n,1)); % Use k diagonals for computing ILU preconditioners. k = input(' Enter number of sub- and super diagonals used for ILU factors = '); k = max(0,k); k = min(n-1,k); % Use x = all ones as a known solution. Generate corresponding right hand % side. x = ones(n,1); b = A*x; %Create a matrix from A using k sub- and super-diagonals. C = A; for j=1:n-k C(k+j+1:n,j) = 0.; C(j,k+j+1:n) = 0.; end % Compute the row pivoted form of LU factorization of C. These factors are % used as pre-conditioners. [L,U,P] = lu(C); tol = 1.E-4; Test_Case = 'test_x'; [z0,sigma_sequence,iterations] = gmres_x(A,b,L,U,P,tol); out = my_summary(n,z0,sigma_sequence,iterations,'test_x'); n = input('Enter space for more computing or 0 to stop... '); if(n==0) break end clear sigma_sequence; end