CGSMGS - Classical Gram–Schmidt vs Modified...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Classical Gram–Schmidt vs Modified Gram–Schmidt Let A ∈ Rm×n , with m ≥ n, and let A have n linearly independent columns a1 , a2 , . . . , an . There are many ways to implement the Gram–Schmidt process. Here are two very different implementations: Classical for k=1:n, w = ak for j = 1:k-1, t rjk = qj w end for j = 1:k-1, w = w − rjk qj end rkk = w 2 qk = w/rkk end Modified for k=1:n, w = ak for j=1:k-1, t rjk = qj w w = w − rjk qj end rkk = w 2 qk = w/rkk end Please study the pseudocode above carefully. In exact arithmetic, these two methods generate exactly the same output. Before going on think about why, in the presence of rounding errors, they behave so differently. In classical Gram–Schmidt (CGS) we compute the (signed) lengths of the orthogonal projections of w = ak onto q1 , q2 , . . . , qk−1 , and then subtract those projections (and the rounding errors) from w. If Qk−1 = [q1 , q2 , . . . , qk−1 ], then the orthogonal projector onto ColSp(Qk−1 ) is P = Qk−1 (Qt −1 Qk−1 )−1 Qt −1 . If Qk−1 has k k orthonormal columns, then P = Qk−1 Qt −1 : k w = (I − Qk−1 Qt −1 )ak . k But because of rounding errors, Qk−1 does not have truly orthogonal columns. In modified Gram–Schmidt (MGS) we compute the length of the projection of w = ak onto q1 and subtract that projection (and the rounding errors) from w. Next we compute the length of the projection of the computed w onto q2 and subtract that projection (and the rounding errors) from w, and so on, but always orthogonalizing against the computed version of w. Evaluated from right to left: t t t w = (I − qk−1 qk−1 ) . . . (I − q2 q2 )(I − q1 q1 )ak . If the computed Qt −1 Qk−1 = I + E , then this is very nearly the same w that would k be computed by w = (I − Qk−1 (Qt −1 Qk−1 )−1 Qt −1 )ak k k where we replace (Qt −1 Qk−1 )−1 by I − E , and is much “more orthogonal” to Qk−1 k than the CGS w. ...
View Full Document

This note was uploaded on 12/18/2010 for the course PHYS 5073 taught by Professor Mark during the Fall '10 term at Arkansas.

Ask a homework question - tutors are online