Graphics Programs Reference
In-Depth Information
(only the columns k and
are affected)
P ik =
P ik
s ( P i + τ
P ik )
(9.20)
P i =
P i +
s ( P ik τ
P i )
Westill havetodecide the orderinwhich the off-diagonal elements of A aretobe
eliminated. Jacobi'soriginal ideawastoattack the largest elementsince this results
in fewest number of rotations. The problem here isthat A hastobesearched for
the largest element after every rotation, which is a time-consuming process. If the
matrix islarge, it isfaster to sweep through it by rowsor columns and annihilate
every element abovesomethresholdvalue. In the nextsweep the thresholdislowered
and the process repeated. We adoptJacobi'soriginal scheme because of its simpler
implementation.
In summary, the Jacobi diagonalizationprocedure, which uses only the upper half
of the matrix, is
1. Find the largest (absolute value) off-diagonal element A k in the upper half of A
.
2. Compute
φ
, t , c and s fromEqs. (9.15)-(9.17).
3. Compute
τ
fromEq. (9.19).
4.
Modify the elements in the upper half of A according to Eqs. (9.18).
5.
Update the transformationmatrix P using Eqs. (9.20).
Repeat the procedure until the A k
, where
ε
is the error tolerance.
jacobi
The function jacobi computes all eigenvalues
λ i and eigenvectors x i of a symmetric,
n
n matrix A by the Jacobi method. The algorithmworks exclusivelywith the upper
triangular partof A , which is destroyedinthe process. The principal diagonalof A is
replacedbythe eigenvalues, and the columns of the transformationmatrix P become
the normalized eigenvectors.
×
function [eVals,eVecs] = jacobi(A,tol)
% Jacobi method for computing eigenvalues and
% eigenvectors of a symmetric matrix A.
% USAGE: [eVals,eVecs] = jacobi(A,tol)
% tol = error tolerance (default is 1.0e-9).
if nargin < 2; tol = 1.0e-9; end
n = size(A,1);
maxRot = 5*(nˆ2);
% Limit number of rotations
Search WWH ::




Custom Search