

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


ASSIGNMENT # 4 (39 points) February 27
Announcements
Due Friday, March 10 in class
(A) classical Gram-Schmidt A = Qˆ Rˆ, (B) modified Gram-Schmidt A = Qˆ Rˆ, (C) doing classical Gram-Schmidt twice: doing a QR factorization of the matrix Q˜ that results from a QR factorization of A to get a better Q, (D) Householder orthogonalization A = QR, and (E) using AG−T^ where GGT^ is the Cholesky factorization of the matrix ATA from the normal equations. (It is not difficult to see that (AG−T)GT^ is a QR factorization of A.) You may write your program in Matlab, C, or Python. Instructions will be given for a Matlab version with modifications in bracketed italics for a C version.
(a) Write a GS function and an MGS function, each having as its parameter a matrix A whose row dimension m is ≥ its column dimension n and each returning an m by n matrix Q obtained by orthonormalizing the columns of A. The GS function should use classical Gram-Schmidt and the MGS function modified Gram-Schmidt. [ In C, also include m and n in the parameter list. ] Do not overwrite the A matrix. Other than for A and Q, there should not be any array storage used by the algorithm. (b) For each of algorithms (A)–(E) above, compute the orthogonalization Q of the n by n Hilbert matrix for n = 2, 3 ,... , 12. The (i, j)th element of a Hilbert matrix is 1/(i+j−1). Print a table with the first column containing the values of n and a remaining five columns containing the following measure of orthogonality − log 10 ‖I − QTQ‖F
for each of the five algorithms. Label each of the columns. For the Householder or- thogonalization you may use the Matlab function qr(·, 0). [For a C program, install CLAPACK and use DGEQRF followed by DORGQR to compute the m by n matrix Q. For installation notes, see http://www.netlib.org/clapack/readme.install For additional help, consult the teaching assistant. It is not necessary to use optimized BLAS. A wrapper and makefile is available from the web page.] For computing AG−T where GGT^ is the Cholesky factorization of ATA, use the Matlab function chol to pro- duce G and use the transpose operator and the slash operator to do postdivision of A by GT. [ For C, use DPOSV to obtain a Cholesky factorization. A wrapper is avail- able from the web page. You probably have to program your own forward substitution to compute (G\AT)T.] Do worry about avoiding division by zero if it causes premature termination of the program. Other Matlab functions used in our solution are eye, sum, and diag.
Turn in a printed copy of your output and your source code listings.
You may leave your answer as a product of 4 by 4 matrices.
(i) Do a (1, n − 1) by (n − 1 , 1) partitioning of Ak − σk+1I and Qk+1 and an (n − 1 , 1) by (n − 1 , 1) partitioning of Rk+1, and show that Qk+1 must be upper Hessenberg. (ii) Do not use the fact that Qk+1 is orthogonal.