Docsity

Assignment 4 for Numerical Linear Algebra | CS 51500, Assignments of Linear Algebra

Toggle sidebar
bg1
COMPUTER SCIENCE 515
Numerical Linear Algebra
SPRING 2006
ASSIGNMENT # 4 (39 points)
February 27
Announcements
•The second examination is Wednesday, March 22 in class (from 12:30 pm to 1:20 pm). It is
a closed book exam, and only pens, pencils, and erasers are permitted. It covers Chapters 3
and 4 of the class notes. Questions are based on Assignments # 3 and # 4 and the “Review
Questions” for Chapters 3 and 4 in the class notes. (It does not explicitly cover unassigned
exercises.)
•Regrading requests for assignments must be submitted to the teaching assistant within two
weeks of their return to the class. Regrading requests for examinations must be submitted to
the instructor within two days of their return to the student.
Due Friday, March 10 in class
0. Look over Chapter 4 of the class notes and Sections 1.8 and 1.9 of the textbook.
1. (22 points) The goal is to compare the effectiveness of five different techniques for orthogo-
nalizing the columns of a matrix A:
(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 ˜
Qthat
results from a QR factorization of Ato get a better Q,
(D) Householder orthogonalization A=QR, and
(E) using AG−Twhere GGTis the Cholesky factorization of the matrix ATAfrom the normal
equations. (It is not difficult to see that (AG−T)GTis 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 mis ≥its column dimension nand each returning an mby n
matrix Qobtained 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 mand nin the parameter list. ] Do not overwrite the Amatrix. Other than for
Aand Q, there should not be any array storage used by the algorithm.
(b) For each of algorithms (A)–(E) above, compute the orthogonalization Qof the nby 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 nand a remaining five columns
containing the following measure of orthogonality
−log10 kI−QTQkF
1
pf2

Partial preview of the text

Download Assignment 4 for Numerical Linear Algebra | CS 51500 and more Assignments Linear Algebra in PDF only on Docsity!

COMPUTER SCIENCE 515

Numerical Linear Algebra

SPRING 2006

ASSIGNMENT # 4 (39 points) February 27

Announcements

  • The second examination is Wednesday, March 22 in class (from 12:30 pm to 1:20 pm). It is a closed book exam, and only pens, pencils, and erasers are permitted. It covers Chapters 3 and 4 of the class notes. Questions are based on Assignments # 3 and # 4 and the “Review Questions” for Chapters 3 and 4 in the class notes. (It does not explicitly cover unassigned exercises.)
  • Regrading requests for assignments must be submitted to the teaching assistant within two weeks of their return to the class. Regrading requests for examinations must be submitted to the instructor within two days of their return to the student.

Due Friday, March 10 in class

  1. Look over Chapter 4 of the class notes and Sections 1.8 and 1.9 of the textbook.
  2. (22 points) The goal is to compare the effectiveness of five different techniques for orthogo- nalizing the columns of a matrix A:

(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.

  1. (6 points) Determine the eigenvalues of xyT^ where x and y are column vectors.
  2. (5 points) Apply an orthogonal similarity transformation to the following matrix so that the (3,1) and (4,1) elements of the transformed matrix are both zero:    

You may leave your answer as a product of 4 by 4 matrices.

  1. (6 points) Prove that the shifted QR iteration preserves an upper Hessenberg form for a matrix with nonzero subdiagonal elements. Hints:

(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.