Graphics Programs Reference
In-Depth Information
A(L,L) = A(L,L) + t*temp;
fori=1:k-1
%Fori<k
temp = A(i,k);
A(i,k) = temp -s*(A(i,L) + tau*temp);
A(i,L) = A(i,L) + s*(temp - tau*A(i,L));
end
fori=k+1:L-1
%Fork<i<L
temp = A(k,i);
A(k,i) = temp - s*(A(i,L) + tau*A(k,i));
A(i,L) = A(i,L) + s*(temp - tau*A(i,L));
end
fori=L+1:n
%Fori>L
temp = A(k,i);
A(k,i) = temp - s*(A(L,i) + tau*temp);
A(L,i) = A(L,i) + s*(temp - tau*A(L,i));
end
fori=1:n %Updatetransformationmatrix
temp = P(i,k);
P(i,k) = temp - s*(P(i,L) + tau*P(i,k));
P(i,L) = P(i,L) + s*(temp - tau*P(i,L));
end
sortEigen
The eigenvalues/eigenvectors returnedby jacobi are not ordered. The function listed
below can be used to sort the results into ascending order of eigenvalues.
function [eVals,eVecs] = sortEigen(eVals,eVecs)
% Sorts eigenvalues & eigenvectors into ascending
% order of eigenvalues.
% USAGE: [eVals,eVecs] = sortEigen(eVals,eVecs)
n = length(eVals);
fori=1:n-1
index = i; val = eVals(i);
forj=i+1:n
if eVals(j) < val
index = j; val = eVals(j);
end
end
Search WWH ::




Custom Search