Feb 13, 2012 #1 V varuniyengar Advanced Member level 4 Joined Jan 18, 2011 Messages 107 Helped 17 Reputation 34 Reaction score 17 Trophy points 1,298 Activity points 1,743 Can some one help me out in finding the QR decomposition of a Hermitian matrix the code that i have written does not work well with complex clc clear all close all %A = [1 1 1; 1 1 0 ; 1 1 2]; A = [1+6j 1-4j 3-2j; 1+4j 8-1j 2+4j ; 3+2j 2-4j 2]; [qq rr] = qr(A); [m n] = size(A); r = zeros(n,n);mm=0; QT = zeros(n,m); Q = A; for k=1:n QT(k, = A,k)'; end for k = 1:n r(k,k) = sqrt(QT(k,*QT(k,'); QT(k, = QT(k,/r(k,k); if(k<n) for j=k+1:n r(k,j)= (A,j)'*QT(k,')'; QT(j,= (QT(j,'-(r(k,j)*QT(k,'))'; end end end thanks in adv
Can some one help me out in finding the QR decomposition of a Hermitian matrix the code that i have written does not work well with complex clc clear all close all %A = [1 1 1; 1 1 0 ; 1 1 2]; A = [1+6j 1-4j 3-2j; 1+4j 8-1j 2+4j ; 3+2j 2-4j 2]; [qq rr] = qr(A); [m n] = size(A); r = zeros(n,n);mm=0; QT = zeros(n,m); Q = A; for k=1:n QT(k, = A,k)'; end for k = 1:n r(k,k) = sqrt(QT(k,*QT(k,'); QT(k, = QT(k,/r(k,k); if(k<n) for j=k+1:n r(k,j)= (A,j)'*QT(k,')'; QT(j,= (QT(j,'-(r(k,j)*QT(k,'))'; end end end thanks in adv
Feb 13, 2012 #2 _Eduardo_ Full Member level 5 Joined Aug 31, 2009 Messages 295 Helped 118 Reputation 238 Reaction score 103 Trophy points 1,323 Location Argentina Activity points 2,909 Why "not work well with complex" ? The only detail is that your code calculates A = QT' * R instead of A = QT * R
Why "not work well with complex" ? The only detail is that your code calculates A = QT' * R instead of A = QT * R