CS 290 I:  Homework #2:  Due Wed 25 February 1:00 pm

 

 

Rules:

 

This assignment is due by 1:00 pm on Wednesday, February 25, 2004.  Turn it in to the CS290I homework box in room 2108 of the Engineering I building (next to the Computer Science Department office), or else turn it in at the beginning of class that day.  Be sure to put your name on it!  You may discuss the problems with other students but what you turn in must be your own work. 

 

Problems:

 

1 [60 points]  (Sparse approximate inverse preconditioning).  See the correction to this problem.

 

a)  Implement a Matlab routine so that “M = spai(A)” returns a sparse approximate inverse of A.  Specifically, M should have the same nonzero pattern as A, and among such matrices it should minimize the Frobenius norm   ||AM – I||F  . 

Hint 1:  Make your Matlab code efficient by using sparse matrices, and by writing one loop with vector indexing rather than nested loops.

            Hint 2:  Create an all-zero sparse matrix with room for a specified number of nonzeros using Matlab’s “spalloc”, then fill it in by columns.

            Hint 3:  Matlab’s matrix division operator  X \ Y” solves a least squares problem if X is not square (for either sparse or full X and Y).

 

b)  Experiment with SPAI as a preconditioner for restarted GMRES, using the nonsymmetric matrices WATT1 and WEST0479.  (Both matrices are available as Matlab .mat files on the course web site.)   Use a fairly short restart for GMRES (20 or so) if it works.  Compare with zero-fill incomplete LU (Matlab’s “luinc(A,’0’)”).  What do you observe?  Turn in your Matlab code, session diary (say “help diary”), and plots.

                     Hint:  As Matlab’s “gmres” is set up, you can’t just pass M to it as the preconditioning argument (because the code uses the preconditioner for a solve, not a matrix-vector multiply), but you can pass a string giving the name of a function that multiplies by M.

 

c)      Give an example of a matrix A (not necessarily a big one) for which A is well-conditioned but spai(A) is all zero.

 

 

 

2 [40 points]  (You may use Matlab for this problem or do it by hand – I’m not sure which is easier.)

 

a)      Show the 9-by-9 matrix A of the two-dimensional model problem on a 3-by-3 grid, factored as A = UUT where U is a matrix that has (i) 9 rows, (ii) no more than 2 nonzeros per column, and (iii) if a column has two nonzeros a and b, then a = -b.  (Notice U is not square.)

 

b)      Show the graph of matrix A (with weights on the edges for nonzero values).  Show a maximum-weight spanning tree of that graph.  (There are a lot of choices.)  Show the matrix B which is the support-graph preconditioner corresponding to the spanning tree you chose.

 

c)      Show B factored as B = VVT, where V is a matrix that satisfies the same three conditions as U above.

 

d)      Find a matrix W with U = VW.  (Notice W is not square.)

 

e)      What are the 2-norm, the 1-norm, the infinity norm, and the Frobenius norm of W?  What is ||WT W||1 ?  What is the condition number of A?  What is the condition number of B-1A?