Rota c s rowrot compute the rotation gi j a where

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: stored in A. m, q] = size(A) for k = 1:q tau = A(1,k) sigma = A(2,k) A(1,k) = c*tau - s*sigma A(2,k) = s*tau + c*sigma end 13 Rotations Function for a post-Givens rotation { The multiplication only a ects columns i and j function A = col.rot(A, c, s) % col.rot: Compute the rotation AGT (i j ) where % A 2 <q 2. The rotation is stored in A. m,q] = size(A) for k = 1:q tau = A(k,1) sigma = A(k,2) A(k,1) = c*tau - s*sigma A(k,2) = s*tau + c*sigma end Each algorithm requires 4q multiplications and 2q additions Let A 2 <m n be such that akl = 0 k = i ; 1 : i, l = 1 : j ; 1 { To make aij = 0 by rotating rows i ; 1 and i c,s] = givens(A(i-1,j), A(i,j)) A (i-1:i,j:n) = row.rot(A (i-1:i,j:n), c, s) 14 Rotations Example 5. Set a33 = 0 by a rotation of rows 2 and 3 when 2 3 32 6 7 A=40 0 5 1 5 0 0 12 ;3 { Using the function c, s] = givens(5,12) yields c = ;0:3846 s = 0:9231 Observe that c2 + s2 = 1 { Performing A (2:3, 3:4) = row.rot (A(2:3, 3:4), c, s) yields 2 3 32 6 7 A = 4 0 0 ;13 2:3846 5 0 0 0 2:0769 15...
View Full Document

Ask a homework question - tutors are online