– | the number of the current Arnoldi iteration; |
– | the number of converged eigenvalues at this point; |
– | the real and imaginary parts of the converged eigenvalues; |
– | the error bounds on the converged eigenvalues. |
None.
Open in the MATLAB editor: f12fe_example
function f12fe_example fprintf('f12fe example results\n\n'); n = int64(100); nev = int64(4); ncv = int64(10); irevcm = int64(0); resid = zeros(n,1); v = zeros(n,ncv); x = zeros(n,1); mx = zeros(n,1); imon = 1; sigma = 1; % Setup and factorize A - sigma*B h = 1/double(n+1); ad(1:n) = 2/h - sigma*4*h/6; adl(1:n) = -1/h - sigma*h/6; adu(1:n) = adl(1:n); [adl, ad, adu, adu2, ipiv, info] = f07cd( ... adl, ad, adu); % Initialisation Step [icomm, comm, ifail] = f12fa( ... n, nev, ncv); % Set Optional Parameters [icomm, comm, ifail] = f12fd( ... 'Generalized', icomm, comm); [icomm, comm, ifail] = f12fd( ... 'Buckling', icomm, comm); % Solve while (irevcm ~= 5) [irevcm, resid, v, x, mx, nshift, comm, icomm, ifail] = ... f12fb( ... irevcm, resid, v, x, mx, comm, icomm); if (irevcm == -1) % Solve (A-sigma*B)y = Ax mx = f12fe_Ax(n, x); [x, info] = f07ce( ... 'N', adl, ad, adu, adu2, ipiv, mx); elseif (irevcm == 1) % Solve (A-sigma*B)y = Ax, Ax in mx [x, info] = f07ce( ... 'N', adl, ad, adu, adu2, ipiv, mx); elseif (irevcm == 2) % y = Ax mx = f12fe_Ax(n, x); elseif (irevcm == 4 && imon == 1) [niter, nconv, ritz, rzest] = ... f12fe(icomm, comm); fprintf(['Iteration %2d, No. converged = %d, ', ... 'norm of estimates = %10.2e\n'], ... niter, nconv, norm(rzest(1:nev),2)); end end % Post-process to compute eigenvalues/vectors [nconv, d, z, v, comm, icomm, ifail] = ... f12fc( ... sigma, resid, v, comm, icomm); fprintf('\nThe %d Eigenvalues closest to %7.2f are:\n',nconv, sigma); disp(d(1:nconv)); function [y] = f12fe_Ax(n,x) y = zeros(n,1); h = 1/double(n+1); dd = 2; dl = -1; du = -1; y(1) = dd*x(1) + du*x(2); for j=2:n-1 y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1); end y(n) = dl*x(n-1) + dd*x(n); y = y/h;
f12fe example results Iteration 1, No. converged = 0, norm of estimates = 2.05e-06 Iteration 2, No. converged = 2, norm of estimates = 6.08e-11 Iteration 3, No. converged = 3, norm of estimates = 5.27e-15 The 4 Eigenvalues closest to 1.00 are: 9.8704 39.4912 88.8909 158.1175