Classical Gram–Schmidt vs Modified Gram–SchmidtLetA∈Rm×n, withm≥n, and letAhavenlinearly independent columnsa1, a2, . . . , an. There are many ways to implement the Gram–Schmidt process. Hereare twoverydifferent implementations:ClassicalModifiedfor k=1:n,for k=1:n,w=akw=akfor j = 1:k-1,for j=1:k-1,rjk=qtjwendrjk=qtjwfor j = 1:k-1,w=w-rjkqjw=w-rjkqjendendrkk=kwk2rkk=kwk2qk=w/rkkqk=w/rkkendendPlease study the pseudocode above carefully. In exact arithmetic, these twomethods generate exactly the same output. Before going on think about why, in thepresence of rounding errors, they behave so differently.In classical Gram–Schmidt (CGS) we compute the (signed) lengths of theorthogonal projections ofw=akontoq1, q2, . . . , qk-1, and then subtract thoseprojections (and the rounding errors) fromw. IfQk-1= [q1, q2, . . . , qk-1], then theorthogonal projector onto ColSp(Qk-1) isP=Qk-1(Qtk-1Qk-1)-1Qtk-1. IfQk-1hasorthonormal columns, thenP=Qk-1Qtk-1:w= (I-Qk-1Q
This is the end of the preview.
access the rest of the document.