dir templates for Base Directory file bicg.m for function [x, error, iter, flag] = bicg(A, x, b, M, max_it, tol) , , % -- Iterative template routine -- , % Univ. of Tennessee and Oak Ridge National Laboratory , % October 1, 1993 , % Details of this algorithm are described in "Templates for the , % Solution of Linear Systems: Building Blocks for Iterative , % Methods", Barrett, Berry, Chan, Demmel, Donato, Dongarra, , % Eijkhout, Pozo, Romine, and van der Vorst, SIAM Publications, , % 1993. (ftp netlib2.cs.utk.edu; cd linalg; get templates.ps). size 2445 file bicgstab.m for function [x, error, iter, flag] = bicgstab(A, x, b, M, max_it, tol) , , % -- Iterative template routine -- , % Univ. of Tennessee and Oak Ridge National Laboratory , % October 1, 1993 , % Details of this algorithm are described in "Templates for the , % Solution of Linear Systems: Building Blocks for Iterative , % Methods", Barrett, Berry, Chan, Demmel, Donato, Dongarra, , % Eijkhout, Pozo, Romine, and van der Vorst, SIAM Publications, , % 1993. (ftp netlib2.cs.utk.edu; cd linalg; get templates.ps). size 2922 file cg.m for function [x, error, iter, flag] = cg(A, x, b, M, max_it, tol) , , % -- Iterative template routine -- , % Univ. of Tennessee and Oak Ridge National Laboratory , % October 1, 1993 , % Details of this algorithm are described in "Templates for the , % Solution of Linear Systems: Building Blocks for Iterative , % Methods", Barrett, Berry, Chan, Demmel, Donato, Dongarra, , % Eijkhout, Pozo, Romine, and van der Vorst, SIAM Publications, , % 1993. (ftp netlib2.cs.utk.edu; cd linalg; get templates.ps). size 2091 file cgs.m for function [x, error, iter, flag] = cgs(A, x, b, M, max_it, tol) , , % -- Iterative template routine -- , % Univ. of Tennessee and Oak Ridge National Laboratory , % October 1, 1993 , % Details of this algorithm are described in "Templates for the , % Solution of Linear Systems: Building Blocks for Iterative , % Methods", Barrett, Berry, Chan, Demmel, Donato, Dongarra, , % Eijkhout, Pozo, Romine, and van der Vorst, SIAM Publications, , % 1993. (ftp netlib2.cs.utk.edu; cd linalg; get templates.ps). size 2367 file cheby.m for function [x, error, iter, flag] = cheby(A, x, b, M, max_it, tol) , , % -- Iterative template routine -- , % Univ. of Tennessee and Oak Ridge National Laboratory , % October 1, 1993 , % Details of this algorithm are described in "Templates for the , % Solution of Linear Systems: Building Blocks for Iterative , % Methods", Barrett, Berry, Chan, Demmel, Donato, Dongarra, , % Eijkhout, Pozo, Romine, and van der Vorst, SIAM Publications, , % 1993. (ftp netlib2.cs.utk.edu; cd linalg; get templates.ps). size 2169 file gmres.m for function [x, error, iter, flag] = gmres( A, x, b, M, restrt, max_it, tol ) , , % -- Iterative template routine -- , % Univ. of Tennessee and Oak Ridge National Laboratory , % October 1, 1993 , % Details of this algorithm are described in "Templates for the , % Solution of Linear Systems: Building Blocks for Iterative , % Methods", Barrett, Berry, Chan, Demmel, Donato, Dongarra, , % Eijkhout, Pozo, Romine, and van der Vorst, SIAM Publications, , % 1993. (ftp netlib2.cs.utk.edu; cd linalg; get templates.ps). size 3389 file jacobi.m for function [x, error, iter, flag] = jacobi(A, x, b, max_it, tol) , , % -- Iterative template routine -- , % Univ. of Tennessee and Oak Ridge National Laboratory , % October 1, 1993 , % Details of this algorithm are described in "Templates for the , % Solution of Linear Systems: Building Blocks for Iterative , % Methods", Barrett, Berry, Chan, Demmel, Donato, Dongarra, , % Eijkhout, Pozo, Romine, and van der Vorst, SIAM Publications, , % 1993. (ftp netlib2.cs.utk.edu; cd linalg; get templates.ps). size 1809 file lehmer.m for function A = lehmer(n) , %LEHMER A = LEHMER(N) is the symmetric positive definite N-by-N matrix with , % A(i,j) = i/j for j>=i. , % A is totally nonnegative. INV(A) is tridiagonal, and explicit , % formulas are known for its entries. , % N <= COND(A) <= 4*N*N. , , % References: , % M. Newman and J. Todd, The evaluation of matrix inversion , % programs, J. Soc. Indust. Appl. Math., 6 (1958), pp. 466-476. size 659 file makefish.m for function mat = makefish(siz); , % make a Poisson matrix , , leng = siz*siz; , dia = zeros(siz,siz); , off = -eye(siz,siz); , for i=1:siz, dia(i,i)=4; end; , for i=1:siz-1, dia(i,i+1)=-1; dia(i+1,i)=-1; end; , mat = zeros(leng,leng); , for ib=1:siz, size 432 file matgen.m for function mat = testmat( siz ); , % , % matrix generator function for templates tester , % , if ( siz == 10 ), , mat = makefish( 4 ); % poisson matrix , elseif ( siz == 20 ), , mat = wathen( 3, 3, 0 ); % spd consistent mass matrix , elseif ( siz == 30 ), , mat = wathen( 3, 3, 1 ); % spd consistent mass matrix size 526 file qmr.m for function [x, error, iter, flag] = qmr( A, x, b, M, max_it, tol ) , , % -- Iterative template routine -- , % Univ. of Tennessee and Oak Ridge National Laboratory , % October 1, 1993 , % Details of this algorithm are described in "Templates for the , % Solution of Linear Systems: Building Blocks for Iterative , % Methods", Barrett, Berry, Chan, Demmel, Donato, Dongarra, , % Eijkhout, Pozo, Romine, and van der Vorst, SIAM Publications, , % 1993. (ftp netlib2.cs.utk.edu; cd linalg; get templates.ps). size 3862 file rotmat.m for function [ c, s ] = rotmat( a, b ) , , % , % Compute the Givens rotation matrix parameters for a and b. , % , if ( b == 0.0 ), , c = 1.0; , s = 0.0; , elseif ( abs(b) > abs(a) ), , temp = a / b; size 353 file sor.m for function [x, error, iter, flag] = sor(A, x, b, w, max_it, tol) , , % -- Iterative template routine -- , % Univ. of Tennessee and Oak Ridge National Laboratory , % October 1, 1993 , % Details of this algorithm are described in "Templates for the , % Solution of Linear Systems: Building Blocks for Iterative , % Methods", Barrett, Berry, Chan, Demmel, Donato, Dongarra, , % Eijkhout, Pozo, Romine, and van der Vorst, SIAM Publications, , % 1993. (ftp netlib2.cs.utk.edu; cd linalg; get templates.ps). size 1921 file split.m for function [ M, N, b ] = split( A, b, w, flag ) , % , % function [ M, N, b ] = split( A, b, w, flag ) , % , % split.m sets up the matrix splitting for the stationary , % iterative methods: jacobi and sor (gauss-seidel when w = 1.0 ) , % , % input A DOUBLE PRECISION matrix , % b DOUBLE PRECISION right hand side vector (for SOR) , % w DOUBLE PRECISION relaxation scalar size 1027 file tester.m for function test_it = templatestester() , % , % function[ test_it ] = templatestester() , % , % templatestester loops over the various MatLab versions of the iterative , % templates. Test matrices are generated in matgen.m. Results are printed , % to the screen. , , % INITIALIZATION , size 9419 file wathen.m for function A = wathen(nx, ny, k) , %WATHEN A = WATHEN(NX,NY) is a random N-by-N finite element matrix , % where N = 3*NX*NY + 2*NX + 2*NY + 1. , % A is precisely the "consistent mass matrix" for a regular NX-by-NY , % grid of 8-node (serendipity) elements in 2 space dimensions. , % A is symmetric positive definite for any (positive) values of , % the "density", RHO(NX,NY), which is chosen randomly in this routine. , % In particular, if D=DIAG(DIAG(A)), then , % 0.25 <= EIG(INV(D)*A) <= 4.5 , % for any positive integers NX and NY and any densities RHO(NX,NY). size 1687 file README for , ============= README file for testing the Iterative Templates ================== , Version 1.0 November 1, 1993. , , This file contains the MATLAB versions of the algorithms discussed in , the book ``Templates for the Solution of Linear Systems: Building Blocks , for Iterative Methods'', by Richard Barrett, Michael Berry, Tony F. Chan, , James Demmel, June Donato, Jack Dongarra, Victor Eijkhout, Roldan Pozo, , Charles Romine, and Henk Van der Vorst, SIAM Publication, 1993. , In addition, there are test routine that a user can execute size 3931