In our previous discussion of Krylov subspaces (pick a vector and build for ). We saw that the Ritz eigenvalues (the extreme eigenvalues) of can be constructed using a subset of the first of these vectors, the approximation improving is precision as increases.
A reminder of some of the terminology: is lower-Hessianberg if for all , and is upper-Hessianberg if for all . Arnoldi iteration uses Kyrlov subspaces to transform symmetric matrix into an upper-Hessianberg form .
Let be subjected to Gram-Schmidt orthogonalization to orthogonal set , which is a basis for the Krylov subspace . Because for we have conjugacy of the vectors with respect to reminiscent of how normal mode vectors are conjugate with respect to the kinetic energy matrix in Physics 711
because for some coefficients . Because a Hermitian matrix has such a simple Hessianberg form, Arnoldi iteration iteration for a Hermitian simplifies dramatically, because at step
the last step having only three terms
which is a rather significant shortening of the inner loop!
So what can we use this for? Given symmetric we can construct a Hessianberg with whose extreme eigenvalues approximate those of to very good precision. We can also completely “Hessenbergerize” as a prelude to full diagonalization.
Let’s write the code in julia
hess=function(M,jmax)
n=size(M)[1]
b=rand(n,1)
r=b
v=zeros(n,jmax);alpha=zeros(jmax);beta=zeros(jmax);
beta[1]=sqrt(sum(r .* r))
for j in 1:jmax
v[:,j]=r/beta[j]
r=A*v[:,j]
if j>1
r=r-v[:,j-1]*beta[j]
end
alpha[j]=r'*v[:,j]
r=r-v[:,j]*alpha[j]
if j<jmax
beta[j+1]=sqrt(sum(r .* r))
end
end
H=zeros(jmax,jmax)
for j in 1:jmax-1
H[j,j]=alpha[j]
H[j,j+1]=beta[j+1]
H[j+1,j]=beta[j+1]
end
H[jmax,jmax]=alpha[jmax]
return H
end
I will create a random symmetrized and approximate its extreme eigenvalues with a Hessenberg :
A=rand(8,8)
A=(A+A')/2
using LinearAlgebra
eigvals(A)
8-element Vector{Float64}:
-0.9978484322893748
-0.7223421236032608
-0.311326659137159
-0.054381916423452685
0.525474010310458
0.7610946030980107
0.8889134731876
4.0740875056699
H1=hess(A,4);
eigvals(H1)
4-element Vector{Float64}:
-0.9921448484528467
0.14096304088606434
0.7822933006834016
4.074085415567306
The agreement is excellent. is not all that big, but you can see the advantages for very large arrays, you can get very good extremal eigenvalues by Arnoldi Hessenberg reductions using an array half the dimension. Of course you can also go all the way and obtain the full tridiagonal Hessenberg similar to your original matrix
H1=hess(A,8)
8×8 Matrix{Float64}:
3.18552 1.73103 0.0 0.0 0.0 0.0 0.0 0.0
1.73103 0.561275 0.73341 0.0 0.0 0.0 0.0 0.0
0.0 0.73341 0.164923 0.5864 0.0 0.0 0.0 0.0
0.0 0.0 0.5864 -0.109781 0.306619 0.0 0.0 0.0
0.0 0.0 0.0 0.306619 -0.415481 0.43705 0.0 0.0
0.0 0.0 0.0 0.0 0.43705 0.302667 0.458932 0.0
0.0 0.0 0.0 0.0 0.0 0.458932 -0.0530971 0.181784
0.0 0.0 0.0 0.0 0.0 0.0 0.181784 0.527644
eigvals(H1)
8-element Vector{Float64}:
-0.9978484322893754
-0.7223421236032609
-0.311326659137159
-0.054381916423452525
0.5254740103104582
0.7610946030980107
0.8889134731876566
4.074087505669898