% Testing program test_z.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. clear all % Read in data for Nachtegal, Reddy, & Trefeften (SIMAX 13(3) 1992). load matdata tol=1e-6; % Use tridiagonal major part of matrix as factor for pre-conditioner. K=n^2; W = spalloc(K,K,3*K); for j=2:K W(j-1,j) = A(j-1,j); W(j,j) = A(j,j); W(j,j-1) = A(j,j-1); end W(1,1) = A(1,1); [L,U,P] = lu(W); clear W; z0 = zeros(K,1); % Solve system with pre-conditioned GMRES algorithm % as proposed by Kincaid and Hanson. disp ' Solve Nachtegal, Reddy, & Trefeften problem using ILU principal tridigaonal preconditioners.' disp ' To start try 75 inner GMRES iterations. Use 0 as initial solution estimate.' while 1 [z0,sigma_sequence,iterations] = gmres_x(A,b,L,U,P,tol,z0); % Plot the reshaped solution, as a surface. % x = reshape(z0,n,n); % surf(x) out=my_summary(n,z0,sigma_sequence,iterations,'test_z'); m = input('Enter space for more computing or 0 to stop... '); if(m==0) break end clear sigma_sequence; % Start over at zero. Otherwise this is likely already a solution. z0 = zeros(K,1); end