# Arnoldi iteration

In numerical linear algebra, the Arnoldi iteration is an eigenvalue algorithm and an important example of an iterative method. Arnoldi finds an approximation to the eigenvalues and eigenvectors of general (possibly non-Hermitian) matrices by constructing an orthonormal basis of the Krylov subspace, which makes it particularly useful when dealing with large sparse matrices.

The Arnoldi method belongs to a class of linear algebra algorithms that give a partial result after a small number of iterations, in contrast to so-called direct methods which must complete to give any useful results (see for example, Householder transformation). The partial result in this case being the first few vectors of the basis the algorithm is building.

When applied to Hermitian matrices it reduces to the Lanczos algorithm. The Arnoldi iteration was invented by W. E. Arnoldi in 1951.

## Krylov subspaces and the power iteration

An intuitive method for finding the largest (in absolute value) eigenvalue of a given m × m matrix $A$ is the power iteration: starting with an arbitrary initial vector b, calculate Ab, A2b, A3b,… normalizing the result after every application of the matrix A.

This sequence converges to the eigenvector corresponding to the eigenvalue with the largest absolute value, $\lambda _{1}$ . However, much potentially useful computation is wasted by using only the final result, $A^{n-1}b$ . This suggests that instead, we form the so-called Krylov matrix:

$K_{n}={\begin{bmatrix}b&Ab&A^{2}b&\cdots &A^{n-1}b\end{bmatrix}}.$ The columns of this matrix are not in general orthogonal, but we can extract an orthogonal basis, via a method such as Gram–Schmidt orthogonalization. The resulting set of vectors is thus an orthogonal basis of the Krylov subspace, ${\mathcal {K}}_{n}$ . We may expect the vectors of this basis to give good approximations of the eigenvectors corresponding to the $n$ largest eigenvalues, for the same reason that $A^{n-1}b$ approximates the dominant eigenvector.

## The Arnoldi iteration

The Arnoldi iteration uses the stabilized Gram–Schmidt process to produce a sequence of orthonormal vectors, q1, q2, q3, …, called the Arnoldi vectors, such that for every n, the vectors q1, …, qn span the Krylov subspace ${\mathcal {K}}_{n}$ . Explicitly, the algorithm is as follows:

• Repeat for k = 2, 3, …
• $q_{k}\leftarrow Aq_{k-1}\,$ • for j from 1 to k − 1
• $h_{j,k-1}\leftarrow q_{j}^{*}q_{k}\,$ • $q_{k}\leftarrow q_{k}-h_{j,k-1}q_{j}\,$ • $h_{k,k-1}\leftarrow \|q_{k}\|\,$ • $q_{k}\leftarrow {\frac {q_{k}}{h_{k,k-1}}}\,$ The j-loop projects out the component of $q_{k}$ in the directions of $q_{1},\dots ,q_{k-1}$ . This ensures the orthogonality of all the generated vectors.

The algorithm breaks down when qk is the zero vector. This happens when the minimal polynomial of A is of degree k. In most applications of the Arnoldi iteration, including the eigenvalue algorithm below and GMRES, the algorithm has converged at this point.

Every step of the k-loop takes one matrix-vector product and approximately 4mk floating point operations.

In the programming language python:

 1 import numpy as np
2 def arnoldi_iteration(A, b, n):
3     """Computes a basis of the (n + 1)-Krylov subspace of A: the space
4     spanned by {b, Ab, ..., A^n b}.
5
6     Input
7     A: m x m array
8     b: initial vector (length m)
9     n: dimension of Krylov subspace, must be >=1
10
11     Returns Q, h
12     Q: m x (n + 1) array, the columns are an orthonormal basis of the
13     Krylov subspace.
14     h: (n + 1) x n array, A on basis Q. It is upper Hessenberg.
15     """
16     m = A.shape
17
18     h = np.zeros((n + 1, n))
19     Q = np.zeros((m, n + 1))
20
21     q = b / np.linalg.norm(b)  # Normalize the input vector
22     Q[:, 0] = q  # Use it as the first Krylov vector
23
24     for k in range(n):
25         v = A.dot(q)  # Generate a new candidate vector
26         for j in range(k + 1):  # Subtract the projections on previous vectors
27             h[j, k] = np.dot(Q[:, j].conj(), v)
28             v = v - h[j, k] * Q[:, j]
29
30         h[k + 1, k] = np.linalg.norm(v)
31         eps = 1e-12  # If v is shorter than this threshold it is the zero vector
32         if h[k + 1, k] > eps:  # Add the produced vector to the list, unless
33             q = v / h[k + 1, k]  #   the zero vector is produced.
34             Q[:, k + 1] = q
35         else:  # If that happens, stop iterating.
36             return Q, h
37     return Q, h


## Properties of the Arnoldi iteration

Let Qn denote the m-by-n matrix formed by the first n Arnoldi vectors q1, q2, …, qn, and let Hn be the (upper Hessenberg) matrix formed by the numbers hj,k computed by the algorithm:

$H_{n}=Q_{n}^{*}AQ_{n}.\,$ We then have

$H_{n}={\begin{bmatrix}h_{1,1}&h_{1,2}&h_{1,3}&\cdots &h_{1,n}\\h_{2,1}&h_{2,2}&h_{2,3}&\cdots &h_{2,n}\\0&h_{3,2}&h_{3,3}&\cdots &h_{3,n}\\\vdots &\ddots &\ddots &\ddots &\vdots \\0&\cdots &0&h_{n,n-1}&h_{n,n}\end{bmatrix}}.$ This yields an alternative interpretation of the Arnoldi iteration as a (partial) orthogonal reduction of A to Hessenberg form. The matrix Hn can be viewed as the representation in the basis formed by the Arnoldi vectors of the orthogonal projection of A onto the Krylov subspace ${\mathcal {K}}_{n}$ .

The matrix Hn can be characterized by the following optimality condition. The characteristic polynomial of Hn minimizes ||p(A)q1||2 among all monic polynomials of degree n. This optimality problem has a unique solution if and only if the Arnoldi iteration does not break down.

The relation between the Q matrices in subsequent iterations is given by

$AQ_{n}=Q_{n+1}{\tilde {H}}_{n}$ where

${\tilde {H}}_{n}={\begin{bmatrix}h_{1,1}&h_{1,2}&h_{1,3}&\cdots &h_{1,n}\\h_{2,1}&h_{2,2}&h_{2,3}&\cdots &h_{2,n}\\0&h_{3,2}&h_{3,3}&\cdots &h_{3,n}\\\vdots &\ddots &\ddots &\ddots &\vdots \\\vdots &&0&h_{n,n-1}&h_{n,n}\\0&\cdots &\cdots &0&h_{n+1,n}\end{bmatrix}}$ is an (n+1)-by-n matrix formed by adding an extra row to Hn.

## Finding eigenvalues with the Arnoldi iteration

The idea of the Arnoldi iteration as an eigenvalue algorithm is to compute the eigenvalues of the orthogonal projection of A onto the Krylov subspace. This projection is represented by Hn. The eigenvalues of Hn are called the Ritz eigenvalues. Since Hn is a Hessenberg matrix of modest size, its eigenvalues can be computed efficiently, for instance with the QR algorithm. This is an example of the Rayleigh-Ritz method.

It is often observed in practice that some of the Ritz eigenvalues converge to eigenvalues of A. Since Hn is n-by-n, it has at most n eigenvalues, and not all eigenvalues of A can be approximated. Typically, the Ritz eigenvalues converge to the extreme eigenvalues of A. This can be related to the characterization of Hn as the matrix whose characteristic polynomial minimizes ||p(A)q1|| in the following way. A good way to get p(A) small is to choose the polynomial p such that p(x) is small whenever x is an eigenvalue of A. Hence, the zeros of p (and thus the Ritz eigenvalues) will be close to the eigenvalues of A.

However, the details are not fully understood yet. This is in contrast to the case where A is symmetric. In that situation, the Arnoldi iteration becomes the Lanczos iteration, for which the theory is more complete.

## Implicitly restarted Arnoldi method (IRAM)

Due to practical storage consideration, common implementations of Arnoldi methods typically restart after some number of iterations. One major innovation in restarting was due to Lehoucq and Sorensen who proposed the Implicitly Restarted Arnoldi Method. They also implemented the algorithm in a freely available software package called ARPACK. This has spurred a number of other variations including Implicitly Restarted Lanczos method. It also influenced how other restarted methods are analyzed. Theoretical results have shown that convergence improves with an increase in the Krylov subspace dimension n. However, an a-priori value of n which would lead to optimal convergence is not known. Recently a dynamic switching strategy has been proposed which fluctuates the dimension n before each restart and thus leads to acceleration in the rate of convergence.