# Some MATLAB Functions

### to accompany The Matrix Eigenvalue Problem: GR and Krylov Subspace Methods,

by David S. Watkins, professor of Mathematics at Washington State University .

Important Notice: These codes are for instructional and recreational use only. They were written with an eye to simplicity, so they lack certain safeguards that a foolproof code would possess. They have not been optimized for speed, nor are they guaranteed to be error free. If you need efficient, well-tested codes for your applications, use the built-in functions provided in MATLAB, or see LAPACK, ARPACK, HAPACK, etc.

### Chapter 3

• showmatrix.m makes a color plot of a matrix. This is used by many of the programs in this collection.
• reflector.m makes a reflector such that Qx = alpha e_1 or Qx = alpha e_n.
• hessgo.m is a simple driver program for downhess.m (or uphess.m).
• downhess.m does a unitary similarity transformation to upper Hessenberg form from top to bottom.
• uphess.m does a unitary similarity transformation to upper Hessenberg form from bottom to top.
• tridiago.m is a simple driver program for pseudotridiag.m.
• pseudotridiag.m transforms a pseudosymmetric matrix to tridiagonal form.
• hyperbolic.m computes a partly hyperbolic matrix such that Hx = alpha e_{1}. (used by pseudotridiag.m)
• hyp_apply.m applies the matrix computed by hyperbolic.m. (used by pseudotridiag.m)

### Chapter 4

• primitiveqr.m does basic unshifted QR iterations and displays them graphically.
• dqd.m does one iteration of the unshifted differential qd algorithm.
• qrgo.m is a simple driver program for downchase.m
• downchase.m does one iteration of the implicit QR algorithm of arbitrary degree.
• rqgo.m is a simple driver program for upchase.m.
• upchase.m does one iteration of the implicit RQ algorithm of arbitrary degree.
• qrexact.m is a simple demonstration of the effect of exact shifts.
• downchase2.m is a variant of downchase.m that is used by qrexact.m.
• hrgo.m is a simple driver program for hrchase.m
• hrchase.m does one iteration of the implicit HR algorithm of arbitrary degree.

### Chapter 7

• blurgo.m is a simple driver program for blurtest.m.
• blurtest.m does an iteration of the QR algorithm of degree m and checks for shift blurring.
• swapgo.m is a driver program for bulgecrash.m.
• bulgecrash.m does a QR and an RQ iteration simultaneously by passing bulges through each other.
• swap.m is a bulge-swapping routine used by bulgecrash.m.

### Chapter 9

• arngo.m is a driver program for arnoldi.m.
• arnoldi.m is the simple Arnoldi process with reorthogonalization.
• arngo2.m is a driver program for arnoldi2.m
• arnoldi2.m is the Arnoldi process with a shift-and-invert option.
• afun.m does a matrix-vector multiply (possibly shift-and-invert)
• symlango.m is a driver program for symlan.m.
• symlan.m is the symmetric Lanczos process with shift-and-invert option and reorthogonalization.
• relango.m is a driver program for relan.m
• relan.m is the symmetric Lanczos process with shift-and-invert option and thick restarts. (second restart method)
• afun.m does a matrix-vector multiply (possibly shift-and-invert)
• hamlango.m is a driver program for hamlan.m.
• hamlan.m is the Hamiltonian Lanczos process.
• hfun.m multiplies a Hamiltonian matrix times a vector.
• symplango.m is a driver program for symplan.m.
• symplan.m is the symplectic Lanczos process.
• sfun.m multiplies a symplectic matrix (Cayley transform of a Hamiltonian matrix) times a vector.
• normalize.m symplectic normalization used by hamlan.m and symplan.m.
• rehamlango.m is a driver program for rehamlan.m
• rehamlan.m does Hamiltonian or symplectic Lanczos process with thick restarts.
• hsort.m is an auxiliary sorting routine used by rehamlan.m.
• hzeig.m is the double-shift HR (HZ) algorithm (used by rehamlan.m).
• hz.m does one double-shift HR (HZ) iteration (used by hzeig.m).
• transetup.m is an auxiliary routine used by hz.m.
• transdown.m is an auxiliary routine used by hz.m.
• blocklango.m is a driver program for blocklan.m.
• blocklan.m is the block symmetric Lanczos process with reorthogonalization.
• afun.m does a matrix-vector multiply (possibly shift-and-invert)