Jacobi eigenvalue algorithm – Wikipedia

before-content-x4

In numerical linear algebra, the Jacobi eigenvalue algorithm is an iterative method for the calculation of the eigenvalues and eigenvectors of a real symmetric matrix (a process known as diagonalization). It is named after Carl Gustav Jacob Jacobi, who first proposed the method in 1846,[1] but only became widely used in the 1950s with the advent of computers.[2]

after-content-x4

Description[edit]

Let

S{displaystyle S}

be a symmetric matrix, and

G=G(i,j,θ){displaystyle G=G(i,j,theta )}

be a Givens rotation matrix. Then:

is symmetric and similar to

after-content-x4
S{displaystyle S}

.

Furthermore,

S{displaystyle S^{prime }}

has entries:

where

s=sin(θ){displaystyle s=sin(theta )}

and

c=cos(θ){displaystyle c=cos(theta )}

.

Since

G{displaystyle G}

is orthogonal,

S{displaystyle S}

and

S{displaystyle S^{prime }}

have the same Frobenius norm

||||F{displaystyle ||cdot ||_{F}}

(the square-root sum of squares of all components), however we can choose

θ{displaystyle theta }

such that

Sij=0{displaystyle S_{ij}^{prime }=0}

, in which case

S{displaystyle S^{prime }}

has a larger sum of squares on the diagonal:

Set this equal to 0, and rearrange:

if

Sjj=Sii{displaystyle S_{jj}=S_{ii}}

In order to optimize this effect, Sij should be the off-diagonal element with the largest absolute value, called the pivot.

The Jacobi eigenvalue method repeatedly performs rotations until the matrix becomes almost diagonal. Then the elements in the diagonal are approximations of the (real) eigenvalues of S.

Convergence[edit]

If

p=Skl{displaystyle p=S_{kl}}

is a pivot element, then by definition

|Sij||p|{displaystyle |S_{ij}|leq |p|}

for

1i,jn,ij{displaystyle 1leq i,jleq n,ineq j}

. Let

Γ(S)2{displaystyle Gamma (S)^{2}}

denote the sum of squares of all off-diagonal entries of

S{displaystyle S}

. Since

S{displaystyle S}

has exactly

2N:=n(n1){displaystyle 2N:=n(n-1)}

off-diagonal elements, we have

p2Γ(S)22Np2{displaystyle p^{2}leq Gamma (S)^{2}leq 2Np^{2}}

or

2p2Γ(S)2/N{displaystyle 2p^{2}geq Gamma (S)^{2}/N}

. Now

Γ(SJ)2=Γ(S)22p2{displaystyle Gamma (S^{J})^{2}=Gamma (S)^{2}-2p^{2}}

. This implies

Γ(SJ)2(11/N)Γ(S)2{displaystyle Gamma (S^{J})^{2}leq (1-1/N)Gamma (S)^{2}}

or

Γ(SJ)(11/N)1/2Γ(S){displaystyle Gamma (S^{J})leq (1-1/N)^{1/2}Gamma (S)}

,
i.e. the sequence of Jacobi rotations converges at least linearly by a factor

(11/N)1/2{displaystyle (1-1/N)^{1/2}}

to a diagonal matrix.

A number of

N{displaystyle N}

Jacobi rotations is called a sweep; let

Sσ{displaystyle S^{sigma }}

denote the result. The previous estimate yields

i.e. the sequence of sweeps converges at least linearly with a factor ≈

e1/2{displaystyle e^{1/2}}

.

However the following result of Schönhage[3] yields locally quadratic convergence. To this end let S have m distinct eigenvalues

λ1,...,λm{displaystyle lambda _{1},…,lambda _{m}}

with multiplicities

ν1,...,νm{displaystyle nu _{1},…,nu _{m}}

and let d > 0 be the smallest distance of two different eigenvalues. Let us call a number of

Jacobi rotations a Schönhage-sweep. If

Ss{displaystyle S^{s}}

denotes the result then

Thus convergence becomes quadratic as soon as

Γ(S)<d2+n21{displaystyle Gamma (S)<{frac {d}{2+{sqrt {{frac {n}{2}}-1}}}}}

Each Jacobi rotation can be done in O(n) steps when the pivot element p is known. However the search for p requires inspection of all N ≈ 1/2 n2 off-diagonal elements. We can reduce this to O(n) complexity too if we introduce an additional index array

m1,,mn1{displaystyle m_{1},,dots ,,,m_{n-1}}

with the property that

mi{displaystyle m_{i}}

is the index of the largest element in row i, (i = 1, …, n − 1) of the current S. Then the indices of the pivot (k, l) must be one of the pairs

(i,mi){displaystyle (i,m_{i})}

. Also the updating of the index array can be done in O(n) average-case complexity: First, the maximum entry in the updated rows k and l can be found in O(n) steps. In the other rows i, only the entries in columns k and l change. Looping over these rows, if

mi{displaystyle m_{i}}

is neither k nor l, it suffices to compare the old maximum at

mi{displaystyle m_{i}}

to the new entries and update

mi{displaystyle m_{i}}

if necessary. If

mi{displaystyle m_{i}}

should be equal to k or l and the corresponding entry decreased during the update, the maximum over row i has to be found from scratch in O(n) complexity. However, this will happen on average only once per rotation. Thus, each rotation has O(n) and one sweep O(n3) average-case complexity, which is equivalent to one matrix multiplication. Additionally the

mi{displaystyle m_{i}}

must be initialized before the process starts, which can be done in n2 steps.

Typically the Jacobi method converges within numerical precision after a small number of sweeps. Note that multiple eigenvalues reduce the number of iterations since

NS<N{displaystyle N_{S}

.

Algorithm[edit]

The following algorithm is a description of the Jacobi method in math-like notation.
It calculates a vector e which contains the eigenvalues and a matrix E which contains the corresponding eigenvectors, i.e.

ei{displaystyle e_{i}}

is an eigenvalue and the column

Ei{displaystyle E_{i}}

an orthonormal eigenvector for

ei{displaystyle e_{i}}

, i = 1, …, n.

procedure jacobi(SRn×n; out eRn; out ERn×n)
  var
    i, k, l, m, stateN
    s, c, t, p, y, d, rR
    indNnchangedLnfunction maxind(kN) ∈ N ! index of largest off-diagonal element in row k
    m := k+1
    for i := k+2 to n do
      ifSki│ > │Skmthen m := i endif
    endfor
    return m
  endfunc

  procedure update(kN; tR) ! update ek and its status
    y := ek; ek := y+t
    if changedk and (y=ek) then changedk := false; state := state−1
    elsif (not changedk) and (yek) then changedk := true; state := state+1
    endif
  endproc

  procedure rotate(k,l,i,jN) ! perform rotation of Sij, Skl┐    ┌     ┐┌ ┐
    │Skl│    │cs││Skl│
    │ │ := │     ││ │
    │Sij│    │s   c││Sij│
    └ ┘    └     ┘└ endproc

  ! init e, E, and arrays ind, changed
  E := I; state := n
  for k := 1 to n do indk := maxind(k); ek := Skk; changedk := true endfor
  while state≠0 do ! next rotation
    m := 1 ! find index (k,l) of pivot p
    for k := 2 to n−1 do
      ifSk indk│ > │Sm indmthen m := k endif
    endfor
    k := m; l := indm; p := Skl
    ! calculate c = cos φ, s = sin φ
    y := (elek)/2; d := │y│+√(p2+y2)
    r := √(p2+d2); c := d/r; s := p/r; t := p2/d
    if y<0 then s := −s; t := −t endif
    Skl := 0.0; update(k,−t); update(l,t)
    ! rotate rows and columns k and l
    for i := 1 to k−1 do rotate(i,k,i,l) endfor
    for i := k+1 to l−1 do rotate(k,i,i,l) endfor
    for i := l+1 to n do rotate(k,i,l,i) endfor
    ! rotate eigenvectors
    for i := 1 to n do┐    ┌     ┐┌ ┐
      │Eik│    │cs││Eik│
      │ │ := │     ││ │
      │Eil│    │s   c││Eil│
      └ ┘    └     ┘└ endfor
    ! update all potentially changed indi
    for i := 1 to n do indi := maxind(i) endfor
  loop
endproc

Notes[edit]

1. The logical array changed holds the status of each eigenvalue. If the numerical value of

ek{displaystyle e_{k}}

or

el{displaystyle e_{l}}

changes during an iteration, the corresponding component of changed is set to true, otherwise to false. The integer state counts the number of components of changed which have the value true. Iteration stops as soon as state = 0. This means that none of the approximations

e1,...,en{displaystyle e_{1},,…,,e_{n}}

has recently changed its value and thus it is not very likely that this will happen if iteration continues. Here it is assumed that floating point operations are optimally rounded to the nearest floating point number.

2. The upper triangle of the matrix S is destroyed while the lower triangle and the diagonal are unchanged. Thus it is possible to restore S if necessary according to

for k := 1 to n−1 do ! restore matrix S
    for l := k+1 to n do
        Skl := Slkendfor
endfor

3. The eigenvalues are not necessarily in descending order. This can be achieved by a simple sorting algorithm.

for k := 1 to n−1 do
    m := k
    for l := k+1 to n do
        if el > emthen
            m := l
        endif
    endfor
    if km then
        swap em,ek
        swap Em,Ekendif
endfor

4. The algorithm is written using matrix notation (1 based arrays instead of 0 based).

5. When implementing the algorithm, the part specified using matrix notation must be performed simultaneously.

6. This implementation does not correctly account for the case in which one dimension is an independent subspace. For example, if given a diagonal matrix, the above implementation will never terminate, as none of the eigenvalues will change. Hence, in real implementations, extra logic must be added to account for this case.

Example[edit]

Let

S=(4306035303006754206067516201050354201050700){displaystyle S={begin{pmatrix}4&-30&60&-35\-30&300&-675&420\60&-675&1620&-1050\-35&420&-1050&700end{pmatrix}}}

Then jacobi produces the following eigenvalues and eigenvectors after 3 sweeps (19 iterations) :

e1=2585.25381092892231{displaystyle e_{1}=2585.25381092892231}

E1=(0.02919332316478605880.3287120557631889970.7914111458331263310.514552749997152907){displaystyle E_{1}={begin{pmatrix}0.0291933231647860588\-0.328712055763188997\0.791411145833126331\-0.514552749997152907end{pmatrix}}}

e2=37.1014913651276582{displaystyle e_{2}=37.1014913651276582}

E2=(0.1791862905354548260.7419177906284534350.1002281369471921990.638282528193614892){displaystyle E_{2}={begin{pmatrix}-0.179186290535454826\0.741917790628453435\-0.100228136947192199\-0.638282528193614892end{pmatrix}}}

e3=1.4780548447781369{displaystyle e_{3}=1.4780548447781369}

E3=(0.5820756994972376500.3705021850670930580.5095786345017996260.514048272222164294){displaystyle E_{3}={begin{pmatrix}-0.582075699497237650\0.370502185067093058\0.509578634501799626\0.514048272222164294end{pmatrix}}}

e4=0.1666428611718905{displaystyle e_{4}=0.1666428611718905}

E4=(0.7926082911637635850.4519231209015997940.3224163985818249920.252161169688241933){displaystyle E_{4}={begin{pmatrix}0.792608291163763585\0.451923120901599794\0.322416398581824992\0.252161169688241933end{pmatrix}}}

Applications for real symmetric matrices[edit]

When the eigenvalues (and eigenvectors) of a symmetric matrix are known, the following
values are easily calculated.

Singular values
The singular values of a (square) matrix A are the square roots of the (non-negative) eigenvalues of
2-norm and spectral radius
The 2-norm of a matrix A is the norm based on the Euclidean vectornorm, i.e. the largest value
Condition number
The condition number of a nonsingular matrix A is defined as
Rank
A matrix A has rank r if it has r columns that are linearly independent while the remaining columns are linearly dependent on these. Equivalently, r is the dimension of the range of A. Furthermore it is the number of nonzero singular values.
In case of a symmetric matrix r is the number of nonzero eigenvalues. Unfortunately because of rounding errors numerical approximations of zero eigenvalues may not be zero (it may also happen that a numerical approximation is zero while the true value is not). Thus one can only calculate the numerical rank by making a decision which of the eigenvalues are close enough to zero.
Pseudo-inverse
The pseudo inverse of a matrix A is the unique matrix
When procedure jacobi (S, e, E) is called, then the relation
Least squares solution
If matrix A does not have full rank, there may not be a solution of the linear system Ax = b. However one can look for a vector x for which
Matrix exponential
From
Linear differential equations
The differential equation x’ Ax, x(0) = a has the solution x(t) = exp(t Aa. For a symmetric matrix S, it follows that
Let

Generalizations[edit]

The Jacobi Method has been generalized to complex Hermitian matrices, general nonsymmetric real and complex matrices as well as block matrices.

Since singular values of a real matrix are the square roots of the eigenvalues of the symmetric matrix

S=ATA{displaystyle S=A^{T}A}

it can also be used for the calculation of these values. For this case, the method is modified in such a way that S must not be explicitly calculated which reduces the danger of round-off errors. Note that

JSJT=JATAJT=JATJTJAJT=BTB{displaystyle JSJ^{T}=JA^{T}AJ^{T}=JA^{T}J^{T}JAJ^{T}=B^{T}B}

with

B:=JAJT{displaystyle B,:=JAJ^{T}}

.

The Jacobi Method is also well suited for parallelism.

References[edit]

Further reading[edit]

External links[edit]


after-content-x4