Вы находитесь на странице: 1из 13

Reduction to Hessenberg or

Tridiagonal Form
Naeemullah Khan

Outline

Eigenvalue Computation Problems


Hessenberg or Tridiagonal Form
Algorithm 1 (Householder Reduction)
Matlab Code
Results
Algorithm 2 (Gram-Schmidt Orthogonalization)
Matlab Code
Results
Uses
Stability analysis

Eigenvalue Computation
Most of the general purpose eigenvalue problem
proceed by computing Schur Factorization.
A
Q j* A Q j
Where A converges to an upper-triangular matrix as
j
The above transformation is split into 2 phases
xxxx
xxxx
xxxx
xxxx

AA*

Phase 1

xxxx
xxxx
xxx
xx

Phase 2

xxxx
xxx
xx
x

Hessenberg or Tridiagonal Form


To compute Schur Factorization A=QTQ*, we apply unitary similarity
transformation to A.
x
x
x
x

x
x
x
x

x
x
x
x

x
x
x
x

Q1*.

x x
x
x
x

Q1*A

x
x
x
x

Q1*A

A
x x x x
x x x
x x
x

x
x
x
x

.Q1

x
x
x
x

x
x
x
x

x
x
x
x

x
x
x
x

Q1*A Q1

What should we do then? Try next best thing.


x x x x
x x x x
x x x x
x x x x

x x x x
Q1*.

A
x x x
x x x
x x
x x

x
x
x
x

x x x x
x x x
x x x

Q1*A

.Q

x x x
x x x
x x
x x

x
x
x
x

Q1*A
Q1*A Q1
After repeating the process m-2 times, we have the
product in Hessenberg form.

Algorithm: Householder Reduction to


Hessenberg form
for k=1 to m-2 do
x=A(k+1:m,k)
vk=sign(x1) llxkll2e1+x
vk=vk/llvkll2
A(k+1:m,k:m)=A(k+1:m,k:m)-2vkvk*A(k+1:m,k:m)
A(1:m,k+1:m)=A(1:m,k+1:m)-2(A(1:m,k+1:m)vk)vk*
end for

Matlab Code (Householder Reduction)


clc
clear
A=5*rand(4)
B=A
A1=A
m=length(A)
for k=1:m-2
x=A(k+1:m,k);
v=x;
v(1)=sign(x(1))*norm(x)+x(1);
v=v/norm(v);
F=v*v'/norm(v);
F=eye(size(F))-2*F;
q=eye(4);
q(k+1:m,k+1:m)=F;
B=q*B*q';
A(k+1:m,k:m)=A(k+1:m,k:m)-2*v*(v'*A(k+1:m,k:m));
A(1:m,k+1:m)=A(1:m,k+1:m)-2*(A(1:m,k+1:m)*v)*v';
end
A;
[Q,AA]=hess(A1);

Results
A=
1.1449
4.5667
0.7619
4.1291

Q1 =
2.6917
4.9807
0.3909
2.2134

0.5333
4.8095
0.0232
3.8746

4.0865
4.3435
0.4222
1.9989

H_A =
1.1449 -4.7669 -1.2014 0.2496
-6.2036 7.6190 0.7615 5.1709
0 -2.2754 0.0558 -0.1990
0
0 -0.0610 -0.6720
Hess_Q =
1.0000
0
0
0
0 -0.7361 0.6766 -0.0182
0 -0.1228 -0.1600 -0.9794
0 -0.6656 -0.7188 0.2009
Hess_A =
1.1449 -4.7669 -1.2014 0.2496
-6.2036 7.6190 0.7615 5.1709
0 -2.2754 0.0558 -0.1990
0
0
-0.0610 -0.6720

1.0000
0
0
0
0 -0.7361 -0.1228 -0.6656
0 -0.1228 0.9913 -0.0471
0 -0.6656 -0.0471 0.7448
A1 =
1.1449
-6.2036
0.0000
0.0000

-4.7669
7.6190
0.4730
2.2257

0.0056
-5.2162
-0.6934
-0.0398

1.2270
0.3301
0.0982
0.0772

Q2 =
1.0000
0
0
0
0 1.0000
0
0
0
0 -0.2079 -0.9782
0
0 -0.9782 0.2079
A2=
1.1449
-6.2036
-0.0000
0.0000

-4.7669
7.6190
-2.2754
0.0000

-1.2014
0.7615
0.0558
-0.0610

0.2496
5.1709
-0.1990
-0.6720

Matlab Code (Gram-Schmidt)


clc
clear
A=5*rand(4)
eig_A=eig(A)
hess(A)
m=length(A);
for i=2:m-1
Q=try1(A(i:m,i-1:m-1),m)
A=Q'*A*Q
end
eig_AH=eig(A)

function Q=try1(A,n)
m=length(A);
m=length(A)
for i=1:m
v(:,i)=A(:,i);
end
for i=1:m
r=norm(v(:,i));
q(:,i)=v(:,i)/r;
for j=i+1:m
r2=q(:,i)'*v(:,j);
v(:,j)=v(:,j)-r2*q(:,i);
end
end
Q=eye(n);
l=length(q);
Q(n-l+1:n,n-l+1:n)=q;
end

Results
A=
0.4930
0.7101
0.8413
0.9812

A1 =
1.5874
1.5821
1.0878
1.2552

4.4646
3.5161
2.7787
0.9222

1.0602
0.3867
4.5690
3.5336

eig_A =
7.5140
-0.1446
0.5090 + 1.6048i
0.5090 - 1.6048i
Hess_A
0.4930 -4.0166 -2.7283 0.0087
-1.4747 6.7104 -0.2253 -1.2007
0 1.6597 0.1011 -0.9926
0
0 2.8746 1.0830
Q1 =
1.0000
0
0
0
0 0.4815 0.8763 -0.0132
0 0.5704 -0.3019 0.7638
0 0.6654 -0.3754 -0.6453

0.4930
1.4747
-0.0000
0.0000

4.0166
6.7104
-0.2106
1.6463

-0.3548
-1.1624
0.8303
-0.8993

2.7051
-0.3758
2.9679
0.3538

Q2 =
1.0000
0
0
0
0 1.0000
0
0
0
0 -0.1269 0.9919
0
0 0.9919 0.1269
A 2=
0.4930
1.4747
0.0000
-0.0000

4.0166
6.7104
1.6597
-0.0000

eig_AH =
7.5140
-0.1446
0.5090 + 1.6048i
0.5090 - 1.6048i

2.7283
-0.2253
0.1011
2.8746

-0.0087
-1.2007
-0.9926
1.0830

Uses
Work for Hessenberg reduction: 10/3(m3)
For Hermitian case reduces to tridiagonal
form: 4/3(m3)
Phase 2 applied to a matrix A require O(m4)
flops
Phase 2 applied to Hessenberg matrix requires
O(m3) steps.
For Hermitian case for calculation of ONLY
eigenvalues phase 2 require O(m2) flops

Stability Analysis
If A Cmxm , Let A=QHQ* and the computed
factors are Q1H1Q1* then we have
Q1H1Q1*=A+A,

llAll/llAll=O(machine)

Questions?

Вам также может понравиться