Integer type:** int32**** int64**** nag_int** show int32 show int32 show int64 show int64 show nag_int show nag_int

F02 — Eigenvalues and Eigenvectors

This chapter provides functions for various types of matrix eigenvalue problem:

- standard eigenvalue problems (finding eigenvalues and eigenvectors of a square matrix A$A$);
- singular value problems (finding singular values and singular vectors of a rectangular matrix A$A$);
- generalized eigenvalue problems (finding eigenvalues and eigenvectors of a matrix pencil A − λB$A-\lambda B$).

The majority of functions for these problems can be found in Chapter F08 which contains software derived from LAPACK (see Anderson et al. (1999)). However, you should read the introduction to this chapter before turning to Chapter F08, especially if you are a new user. Chapter F12 contains functions for large sparse eigenvalue problems, although one such function is also available in this chapter.

Chapters F02 and F08 contain **Black Box** (or **Driver**) functions that enable many problems to be solved by a call to a single function, and the decision trees in Section [Decision Trees] direct you to the most appropriate functions in Chapters F02 and F08.
The Chapter F02 functions call functions in Chapters F07 and F08 wherever possible to perform the computations, and there are pointers in Section [Decision Trees] to the relevant decision trees in Chapter F08.

Here we describe the different types of problem which can be tackled by the functions in this chapter, and give a brief outline of the methods used to solve them. If you have one specific type of problem to solve, you need only read the relevant sub-section and then turn to Section [Recommendations on Choice and Use of Available Functions]. Consult a standard textbook for a more thorough discussion, for example Golub and Van Loan (1996) or Parlett (1998).

In each sub-section, we first describe the problem in terms of real matrices. The changes needed to adapt the discussion to complex matrices are usually simple and obvious: a matrix transpose such as Q^{T}${Q}^{\mathrm{T}}$ must be replaced by its conjugate transpose Q^{H}${Q}^{\mathrm{H}}$; symmetric matrices must be replaced by Hermitian matrices, and orthogonal matrices by unitary matrices. Any additional changes are noted at the end of the sub-section.

Let A$A$ be a square matrix of order n$n$. The standard eigenvalue problem is to find eigenvalues, λ$\lambda $, and corresponding eigenvectors, x ≠ 0$x\ne 0$, such that

(The phrase ‘eigenvalue problem’ is sometimes abbreviated to eigenproblem.)

Ax = λx.
$$Ax=\lambda x\text{.}$$ | (1) |

If A$A$ is real symmetric, the eigenvalue problem has many desirable features, and it is advisable to take advantage of symmetry whenever possible.

The eigenvalues λ$\lambda $ are all real, and the eigenvectors can be chosen to be mutually orthogonal. That is, we can write

or equivalently:

where Λ$\Lambda $ is a real diagonal matrix whose diagonal elements λ_{i}${\lambda}_{i}$ are the eigenvalues, and Z$Z$ is a real orthogonal matrix whose columns z_{i}${z}_{i}$ are the eigenvectors. This implies that
z_{i}^{T}
z_{j}
=
0
${z}_{i}^{\mathrm{T}}{z}_{j}=0$ if i ≠ j$i\ne j$, and ‖z_{i}‖_{2} = 1${\Vert {z}_{i}\Vert}_{2}=1$.

Az _{i} = λ_{i}z_{i} for i = 1,2, … ,n
$$A{z}_{i}={\lambda}_{i}{z}_{i}\text{\hspace{1em} for}i=1,2,\dots ,n$$ |

AZ = ZΛ
$$AZ=Z\Lambda $$ | (2) |

Equation (2) can be rewritten

This is known as the eigen-decomposition or spectral factorization of A$A$.

A = ZΛZ ^{T}.
$$A=Z\Lambda {Z}^{\mathrm{T}}\text{.}$$ | (3) |

Eigenvalues of a real symmetric matrix are well-conditioned, that is, they are not unduly sensitive to perturbations in the original matrix A$A$. The sensitivity of an eigenvector depends on how small the gap is between its eigenvalue and any other eigenvalue: the smaller the gap, the more sensitive the eigenvector. More details on the accuracy of computed eigenvalues and eigenvectors are given in the function documents, and in the F08 Chapter Introduction.

For dense or band matrices, the computation of eigenvalues and eigenvectors proceeds in the following stages:

- A$A$ is reduced to a symmetric tridiagonal matrix T$T$ by an orthogonal similarity transformation: A = QTQ
^{T}$A=QT{Q}^{\mathrm{T}}$, where Q$Q$ is orthogonal. (A tridiagonal matrix is zero except for the main diagonal and the first subdiagonal and superdiagonal on either side.) T$T$ has the same eigenvalues as A$A$ and is easier to handle. - Eigenvalues and eigenvectors of T$T$ are computed as required. If all eigenvalues (and optionally eigenvectors) are required, they are computed by the QR$QR$ algorithm, which effectively factorizes T$T$ as T = SΛS
^{T}$T=S\Lambda {S}^{\mathrm{T}}$, where S$S$ is orthogonal. If only selected eigenvalues are required, they are computed by bisection, and if selected eigenvectors are required, they are computed by inverse iteration. If s$s$ is an eigenvector of T$T$, then Qs$Qs$ is an eigenvector of A$A$.

All the above remarks also apply – with the obvious changes – to the case when A$A$ is a complex Hermitian matrix. The eigenvectors are complex, but the eigenvalues are all real, and so is the tridiagonal matrix T$T$.

If A$A$ is large and sparse, the methods just described would be very wasteful in both storage and computing time, and therefore an alternative algorithm, known as subspace iteration, is provided (for real problems only) to find a (usually small) subset of the eigenvalues and their corresponding eigenvectors. Chapter F12 contains functions based on the Lanczos method for real symmetric large sparse eigenvalue problems, and these functions are usually more efficient than subspace iteration.

A real nonsymmetric matrix A$A$ may have complex eigenvalues, occurring as complex conjugate pairs. If x$x$ is an eigenvector corresponding to a complex eigenvalue λ$\lambda $, then the complex conjugate vector x$\stackrel{-}{x}$ is the eigenvector corresponding to the complex conjugate eigenvalue λ$\stackrel{-}{\lambda}$. Note that the vector x$x$ defined in equation (1) is sometimes called a right eigenvector; a left eigenvector
y$y$ is defined by

Functions in this chapter only compute right eigenvectors (the usual requirement), but functions in Chapter F08 can compute left or right eigenvectors or both.

y ^{H}A = λy^{H} or A^{T}y = λy.
$${y}^{\mathrm{H}}A=\lambda {y}^{\mathrm{H}}\text{\hspace{1em} or \hspace{1em}}{A}^{\mathrm{T}}y=\stackrel{-}{\lambda}y\text{.}$$ |

The eigenvalue problem can be solved via the Schur factorization of A$A$, defined as

where Z$Z$ is an orthogonal matrix and T$T$ is a real upper quasi-triangular matrix, with the same eigenvalues as A$A$. T$T$ is called the Schur form of A$A$. If all the eigenvalues of A$A$ are real, then T$T$ is upper triangular, and its diagonal elements are the eigenvalues of A$A$. If A$A$ has complex conjugate pairs of eigenvalues, then T$T$ has 2$2$ by 2$2$ diagonal blocks, whose eigenvalues are the complex conjugate pairs of eigenvalues of A$A$. (The structure of T$T$ is simpler if the matrices are complex – see below.)

A = ZTZ ^{T},
$$A=ZT{Z}^{\mathrm{T}}\text{,}$$ |

For example, the following matrix is in quasi-triangular form

and has eigenvalues 1$1$, 2 ± i$2\pm i$, and 3$3$. (The elements indicated by ‘ * $*$’ may take any values.)

$$\left(\begin{array}{rrrr}1& *& *& *\\ 0& 2& -1& *\\ 0& 1& 2& *\\ 0& 0& 0& 3\end{array}\right)$$ |

The columns of Z$Z$ are called the Schur vectors. For each k(1 ≤ k ≤ n)$k(1\le k\le n)$, the first k$k$ columns of Z$Z$ form an orthonormal basis for the invariant subspace corresponding to the first k$k$ eigenvalues on the diagonal of T$T$. (An invariant subspace (for A$A$) is a subspace S$S$ such that for any vector v$v$ in S$S$, Av$Av$ is also in S$S$.) Because this basis is orthonormal, it is preferable in many applications to compute Schur vectors rather than eigenvectors. It is possible to order the Schur factorization so that any desired set of k$k$ eigenvalues occupy the k$k$ leading positions on the diagonal of T$T$, and functions for this purpose are provided in Chapter F08.

Note that if A$A$ is symmetric, the Schur vectors are the same as the eigenvectors, but if A$A$ is nonsymmetric, they are distinct, and the Schur vectors, being orthonormal, are often more satisfactory to work with in numerical computation.

Eigenvalues and eigenvectors of a nonsymmetric matrix may be ill-conditioned, that is, sensitive to perturbations in A$A$. Chapter F08 contains functions which compute or estimate the condition numbers of eigenvalues and eigenvectors, and the F08 Chapter Introduction gives more details about the error analysis of nonsymmetric eigenproblems. The accuracy with which eigenvalues and eigenvectors can be obtained is often improved by balancing a matrix. This is discussed further in Section [Balancing for Nonsymmmetric Eigenproblems].

Computation of eigenvalues, eigenvectors or the Schur factorization proceeds in the following stages:

- A$A$ is reduced to an upper Hessenberg matrix H$H$ by an orthogonal similarity transformation: A = QHQ
^{T}$A=QH{Q}^{\mathrm{T}}$, where Q$Q$ is orthogonal. (An upper Hessenberg matrix is zero below the first subdiagonal.) H$H$ has the same eigenvalues as A$A$, and is easier to handle. - The upper Hessenberg matrix H$H$ is reduced to Schur form T$T$ by the QR$QR$ algorithm, giving the Schur factorization H = STS
^{T}$H=ST{S}^{\mathrm{T}}$. The eigenvalues of A$A$ are obtained from the diagonal blocks of T$T$. The matrix Z$Z$ of Schur vectors (if required) is computed as Z = QS$Z=QS$. - After the eigenvalues have been found, eigenvectors may be computed, if required, in two different ways. Eigenvectors of H$H$ can be computed by inverse iteration, and then pre-multiplied by Q$Q$ to give eigenvectors of A$A$; this approach is usually preferred if only a few eigenvectors are required. Alternatively, eigenvectors of T$T$ can be computed by back-substitution, and pre-multiplied by Z$Z$ to give eigenvectors of A$A$.

All the above remarks also apply – with the obvious changes – to the case when A$A$ is a complex matrix. The eigenvalues are in general complex, so there is no need for special treatment of complex conjugate pairs, and the Schur form T$T$ is simply a complex upper triangular matrix.

As for the symmetric eigenvalue problem, if A$A$ and is large and sparse then it is generally preferable to use an alternative method. Chapter F12 provides functions based on Arnoldi's method for both real and complex matrices, intended to find a subset of the eigenvalues and vectors.

The singular value decomposition (SVD) of a real m$m$ by n$n$ matrix A$A$ is given by

where U$U$ and V$V$ are orthogonal and Σ$\Sigma $ is an m$m$ by n$n$ diagonal matrix with real diagonal elements, σ_{i}${\sigma}_{i}$, such that

The σ_{i}${\sigma}_{i}$ are the singular values of A$A$ and the first min (m,n)$\mathrm{min}\phantom{\rule{0.125em}{0ex}}(m,n)$ columns of U$U$ and V$V$ are, respectively, the left and right singular vectors of A$A$. The singular values and singular vectors satisfy

where u_{i}${u}_{i}$ and v_{i}${v}_{i}$ are the i$i$th columns of U$U$ and V$V$ respectively.

A = UΣV ^{T},
$$A=U\Sigma {V}^{\mathrm{T}}\text{,}$$ |

σ _{1} ≥ σ_{2} ≥ ⋯ ≥ σ_{min (m,n)} ≥ 0.
$${\sigma}_{1}\ge {\sigma}_{2}\ge \cdots \ge {\sigma}_{\mathrm{min}\phantom{\rule{0.125em}{0ex}}(m,n)}\ge 0\text{.}$$ |

Av _{i} = σ_{i}u_{i} and A^{T}u_{i} = σ_{i}v_{i}
$$A{v}_{i}={\sigma}_{i}{u}_{i}\text{\hspace{1em} and \hspace{1em}}{A}^{\mathrm{T}}{u}_{i}={\sigma}_{i}{v}_{i}$$ |

The singular value decomposition of A$A$ is closely related to the eigen-decompositions of the symmetric matrices A^{T}A${A}^{\mathrm{T}}A$ or AA^{T}$A{A}^{\mathrm{T}}$, because:

However, these relationships are not recommended as a means of computing singular values or vectors unless A$A$ is sparse and functions from Chapter F12 are to be used.

A ^{T}Av_{i} = σ_{i}^{2}v_{i} and AA^{T}u_{i} = σ_{i}^{2}u_{i}.
$${A}^{\mathrm{T}}A{v}_{i}={\sigma}_{i}^{2}{v}_{i}\text{\hspace{1em} and \hspace{1em}}A{A}^{\mathrm{T}}{u}_{i}={\sigma}_{i}^{2}{u}_{i}\text{.}$$ |

If U_{k}${U}_{k}$, V_{k}${V}_{k}$ denote the leading k$k$ columns of U$U$ and V$V$ respectively, and if Σ_{k}${\Sigma}_{k}$ denotes the leading principal submatrix of Σ $\Sigma $, then

is the best rank-k$k$ approximation to A$A$ in both the 2$2$-norm and the Frobenius norm.

A _{k}
≡
U_{k}
Σ_{k}
V^{T}_{k}
$${A}_{k}\equiv {U}_{k}{\Sigma}_{k}{{V}^{\mathrm{T}}}_{k}$$ |

Singular values are well-conditioned; that is, they are not unduly sensitive to perturbations in A$A$. The sensitivity of a singular vector depends on how small the gap is between its singular value and any other singular value: the smaller the gap, the more sensitive the singular vector. More details on the accuracy of computed singular values and vectors are given in the function documents and in the F08 Chapter Introduction.

The singular value decomposition is useful for the numerical determination of the rank of a matrix, and for solving linear least squares problems, especially when they are rank-deficient (or nearly so). See Chapter F04.

Computation of singular values and vectors proceeds in the following stages:

- A$A$ is reduced to an upper bidiagonal matrix B$B$ by an orthogonal transformation A = U
_{1}BV_{1}^{T}$A={U}_{1}B{V}_{1}^{\mathrm{T}}$, where U_{1}${U}_{1}$ and V_{1}${V}_{1}$ are orthogonal. (An upper bidiagonal matrix is zero except for the main diagonal and the first superdiagonal.) B$B$ has the same singular values as A$A$, and is easier to handle. - The SVD of the bidiagonal matrix B$B$ is computed as
B
=
U
_{2}Σ V_{2}^{T}$B={U}_{2}\Sigma {V}_{2}^{\mathrm{T}}$, where U_{2}${U}_{2}$ and V_{2}${V}_{2}$ are orthogonal and Σ$\Sigma $ is diagonal as described above. Then in the SVD of A$A$, U = U_{1}U_{2}$U={U}_{1}{U}_{2}$ and V = V_{1}V_{2}$V={V}_{1}{V}_{2}$.

All the above remarks also apply – with the obvious changes – to the case when A$A$ is a complex matrix. The singular vectors are complex, but the singular values are real and non-negative, and the bidiagonal matrix B$B$ is also real.

By formulating the problems appropriately, real large sparse singular value problems may be solved using the symmetric eigenvalue functions in Chapter F12.

Let A$A$ and B$B$ be square matrices of order n$n$. The generalized eigenvalue problem is to find eigenvalues, λ$\lambda $, and corresponding eigenvectors, x ≠ 0$x\ne 0$, such that

For given A$A$ and B$B$, the set of all matrices of the form A − λB$A-\lambda B$ is called a pencil, and λ$\lambda $ and x$x$ are said to be an eigenvalue and eigenvector of the pencil A − λB$A-\lambda B$.

Ax = λBx.
$$Ax=\lambda Bx\text{.}$$ | (4) |

When B$B$ is nonsingular, equation (4) is mathematically equivalent to (B^{ − 1}A)x = λx$\left({B}^{-1}A\right)x=\lambda x$, and when A$A$ is nonsingular, it is equivalent to (A^{ − 1}B)x = (1 / λ)x$\left({A}^{-1}B\right)x=(1/\lambda )x$. Thus, in theory, if one of the matrices A$A$ or B$B$ is known to be nonsingular, the problem could be reduced to a standard eigenvalue problem.

However, for this reduction to be satisfactory from the point of view of numerical stability, it is necessary not only that B$B$ (or A$A$) should be nonsingular, but that it should be well-conditioned with respect to inversion. The nearer B$B$ is to singularity, the more unsatisfactory B^{ − 1}A${B}^{-1}A$ will be as a vehicle for determining the required eigenvalues. Well-determined eigenvalues of the original problem (4) may be poorly determined even by the correctly rounded version of B^{ − 1}A${B}^{-1}A$.

We consider first a special class of problems in which B$B$ is known to be nonsingular, and then return to the general case in the following sub-section.

If A$A$ and B$B$ are symmetric and B$B$ is positive definite, then the generalized eigenvalue problem has desirable properties similar to those of the standard symmetric eigenvalue problem. The eigenvalues are all real, and the eigenvectors, while not orthogonal in the usual sense, satisfy the relations
z_{i}^{T}
B
z_{j}
=
0
${z}_{i}^{\mathrm{T}}B{z}_{j}=0$ for i ≠ j$i\ne j$ and can be normalized so that
z_{i}^{T}
B
z_{i}
=
1
${z}_{i}^{\mathrm{T}}B{z}_{i}=1$.

Note that it is not enough for A$A$ and B$B$ to be symmetric; B$B$ must also be positive definite, which implies nonsingularity. Eigenproblems with these properties are referred to as symmetric-definite problems.

If Λ$\Lambda $ is the diagonal matrix whose diagonal elements are the eigenvalues, and Z$Z$ is the matrix whose columns are the eigenvectors, then

To compute eigenvalues and eigenvectors, the problem can be reduced to a standard symmetric eigenvalue problem, using the Cholesky factorization of B$B$ as LL^{T}$L{L}^{\mathrm{T}}$ or U^{T}U${U}^{\mathrm{T}}U$ (see Chapter F07). Note, however, that this reduction does implicitly involve the inversion of B$B$, and hence this approach should not be used if B$B$ is ill-conditioned with respect to inversion.

Z ^{T}AZ = Λ and Z^{T}BZ = I.
$${Z}^{\mathrm{T}}AZ=\Lambda \text{\hspace{1em} and \hspace{1em}}{Z}^{\mathrm{T}}BZ=I\text{.}$$ |

For example, with B = LL^{T}$B=L{L}^{\mathrm{T}}$, we have

Hence the eigenvalues of Az = λBz$Az=\lambda Bz$ are those of Cy = λy$Cy=\lambda y$, where C$C$ is the symmetric matrix
C
=
L^{ − 1}
AL^{ − T}
$C={L}^{-1}A{L}^{-\mathrm{T}}$ and y = L^{T}z$y={L}^{\mathrm{T}}z$. The standard symmetric eigenproblem Cy = λy$Cy=\lambda y$ may be solved by the methods described in Section [Standard symmetric eigenvalue problems]. The eigenvectors z$z$ of the original problem may be recovered by computing
z
=
L^{ − T}
y
$z={L}^{-\mathrm{T}}y$.

Az = λBz
⇔
(L ^{ − 1}AL^{ − T})
(L^{T}z)
=
λ(L^{T}z)
.
$$Az=\lambda Bz\iff \left({L}^{-1}A{L}^{-\mathrm{T}}\right)\left({L}^{\mathrm{T}}z\right)=\lambda \left({L}^{\mathrm{T}}z\right)\text{.}$$ |

Most of the functions which solve this class of problems can also solve the closely related problems

where again A$A$ and B$B$ are symmetric and B$B$ is positive definite. See the function documents for details.

ABx = λx or BAx = λx
$$ABx=\lambda x\text{\hspace{1em} or \hspace{1em}}BAx=\lambda x$$ |

All the above remarks also apply – with the obvious changes – to the case when A$A$ and B$B$ are complex Hermitian matrices. Such problems are called Hermitian-definite. The eigenvectors are complex, but the eigenvalues are all real.

If A$A$ and B$B$ are large and sparse, reduction to an equivalent standard eigenproblem as described above would almost certainly result in a large dense matrix C$C$, and hence would be very wasteful in both storage and computing time. The methods of subspace iteration and Lanczos type methods, mentioned in Section [Standard symmetric eigenvalue problems], can also be used for large sparse generalized symmetric-definite problems.

Any generalized eigenproblem which is not symmetric-definite with well-conditioned B$B$ must be handled as if it were a general nonsymmetric problem.

If B$B$ is singular, the problem has infinite eigenvalues. These are not a problem; they are equivalent to zero eigenvalues of the problem Bx = μAx$Bx=\mu Ax$. Computationally they appear as very large values.

If A$A$ and B$B$ are both singular and have a common null space, then A − λB$A-\lambda B$ is singular for all λ$\lambda $; in other words, any value λ$\lambda $ can be regarded as an eigenvalue. Pencils with this property are called singular.

As with standard nonsymmetric problems, a real problem may have complex eigenvalues, occurring as complex conjugate pairs.

The generalized eigenvalue problem can be solved via the generalized Schur factorization of A$A$ and B$B$:

where Q$Q$ and Z$Z$ are orthogonal, V$V$ is upper triangular, and U$U$ is upper quasi-triangular (defined just as in Section [Standard nonsymmetric eigenvalue problems]).

A = QUZ ^{T}, B = QVZ^{T}
$$A=QU{Z}^{\mathrm{T}}\text{, \hspace{1em}}B=QV{Z}^{\mathrm{T}}$$ |

If all the eigenvalues are real, then U$U$ is upper triangular; the eigenvalues are given by λ_{i} = u_{ii} / v_{ii}${\lambda}_{i}={u}_{ii}/{v}_{ii}$. If there are complex conjugate pairs of eigenvalues, then U$U$ has 2$2$ by 2$2$ diagonal blocks.

Eigenvalues and eigenvectors of a generalized nonsymmetric problem may be ill-conditioned; that is, sensitive to perturbations in A$A$ or B$B$.

Particular care must be taken if, for some i$i$, u_{ii} = v_{ii} = 0${u}_{ii}={v}_{ii}=0$, or in practical terms if u_{ii}${u}_{ii}$ and v_{ii}${v}_{ii}$ are both small; this means that the pencil is singular, or approximately so. Not only is the particular value λ_{i}${\lambda}_{i}$ undetermined, but also **no reliance** can be placed on **any** of the computed eigenvalues. See also the function documents.

Computation of eigenvalues and eigenvectors proceeds in the following stages.

- The pencil A − λB$A-\lambda B$ is reduced by an orthogonal transformation to a pencil H − λK$H-\lambda K$ in which H$H$ is upper Hessenberg and K$K$ is upper triangular:
A
=
Q
_{1}H Z_{1}^{T}$A={Q}_{1}H{Z}_{1}^{\mathrm{T}}$ and B = Q_{1}K Z_{1}^{T}$B={Q}_{1}K{Z}_{1}^{\mathrm{T}}$. The pencil H − λK$H-\lambda K$ has the same eigenvalues as A − λB$A-\lambda B$, and is easier to handle. - The upper Hessenberg matrix H$H$ is reduced to upper quasi-triangular form, while K$K$ is maintained in upper triangular form, using the QZ$QZ$ algorithm. This gives the generalized Schur factorization: H = Q
_{2}UZ_{2}$H={Q}_{2}U{Z}_{2}$ and K = Q_{2}VZ_{2}$K={Q}_{2}V{Z}_{2}$. - Eigenvectors of the pencil U − λV$U-\lambda V$ are computed (if required) by back-substitution, and pre-multiplied by Z
_{1}Z_{2}${Z}_{1}{Z}_{2}$ to give eigenvectors of A$A$.

All the above remarks also apply – with the obvious changes – to the case when A$A$ and B$B$ are complex matrices. The eigenvalues are in general complex, so there is no need for special treatment of complex conjugate pairs, and the matrix U$U$ in the generalized Schur factorization is simply a complex upper triangular matrix.

As for the generalized symmetric-definite eigenvalue problem, if A$A$ and B$B$ are large and sparse then it is generally preferable to use an alternative method. Chapter F12 provides functions based on Arnoldi's method for both real and complex matrices, intended to find a subset of the eigenvalues and vectors.

Functions in the NAG Toolbox for solving eigenvalue problems fall into two categories.

**Black Box Functions**: these are designed to solve a standard type of problem in a single call – for example, to compute all the eigenvalues and eigenvectors of a real symmetric matrix. You are recommended to use a black box function if there is one to meet your needs; refer to the decision tree in Section [Black Box s] or the index in Section [Functionality Index].**General Purpose Functions**: these perform the computational subtasks which make up the separate stages of the overall task, as described in Section [Background to the Problems] – for example, reducing a real symmetric matrix to tridiagonal form. General purpose functions are to be found, for historical reasons, some in this chapter, a few in Chapter F01, but most in Chapter F08. If there is no black box function that meets your needs, you will need to use one or more general purpose functions.

The decision trees in Section [General Purpose s (Eigenvalues and Eigenvectors)] list the combinations of general purpose functions which are needed to solve many common types of problem.

Sometimes a combination of a black box function and one or more general purpose functions will be the most convenient way to solve your problem: the black box function can be used to compute most of the results, and a general purpose function can be used to perform a subsidiary computation, such as computing condition numbers of eigenvalues and eigenvectors.

The decision trees and the function documents make a distinction between functions which compute all eigenvalues or eigenvectors, and functions which compute selected eigenvalues or eigenvectors; the two classes of function use different algorithms.

It is difficult to give clear guidance on which of these two classes of function to use in a particular case, especially with regard to computing eigenvectors. If you only wish to compute a very few eigenvectors, then a function for selected eigenvectors will be more economical, but if you want to compute a substantial subset (an old rule of thumb suggested more than 25%), then it may be more economical to compute all of them. Conversely, if you wish to compute all the eigenvectors of a sufficiently large symmetric tridiagonal matrix, the function for selected eigenvectors may be faster.

The choice depends on the properties of the matrix and on the computing environment; if it is critical, you should perform your own timing tests.

For dense nonsymmetric eigenproblems, there are no algorithms provided for computing selected eigenvalues; it is always necessary to compute all the eigenvalues, but you can then select specific eigenvectors for computation by inverse iteration.

Functions which handle symmetric matrices are usually designed to use either the upper or lower triangle of the matrix; it is not necessary to store the whole matrix. If either the upper or lower triangle is stored conventionally in the upper or lower triangle of a two-dimensional array, the remaining elements of the array can be used to store other useful data. However, that is not always convenient, and if it is important to economize on storage, the upper or lower triangle can be stored in a one-dimensional array of length n(n + 1) / 2$n(n+1)/2$; in other words, the storage is almost halved. This storage format is referred to as packed storage.

Functions designed for packed storage are usually less efficient, especially on high-performance computers, so there is a trade-off between storage and efficiency.

A band matrix is one whose nonzero elements are confined to a relatively small number of subdiagonals or superdiagonals on either side of the main diagonal. Algorithms can take advantage of bandedness to reduce the amount of work and storage required.

Functions which take advantage of packed storage or bandedness are provided for both standard symmetric eigenproblems and generalized symmetric-definite eigenproblems.

There are two preprocessing steps which one may perform on a nonsymmetric matrix A$A$ in order to make its eigenproblem easier. Together they are referred to as balancing.

**Permutation**: this involves reordering the rows and columns to make A$A$ more nearly upper triangular (and thus closer to Schur form): A^{′}= PAP^{T}${A}^{\prime}=PA{P}^{\mathrm{T}}$, where P$P$ is a permutation matrix. If A$A$ has a significant number of zero elements, this preliminary permutation can reduce the amount of work required, and also improve the accuracy of the computed eigenvalues. In the extreme case, if A$A$ is permutable to upper triangular form, then no floating point operations are needed to reduce it to Schur form.**Scaling**: a diagonal matrix D$D$ is used to make the rows and columns of A^{′}${A}^{\prime}$ more nearly equal in norm: A^{ ′ ′ }= DA^{′}D^{ − 1}${A}^{\prime \prime}=D{A}^{\prime}{D}^{-1}$. Scaling can make the matrix norm smaller with respect to the eigenvalues, and so possibly reduce the inaccuracy contributed by roundoff (see Chapter II/11 of Wilkinson and Reinsch (1971)).

Functions are provided in Chapter F08 for performing either or both of these preprocessing steps, and also for transforming computed eigenvectors or Schur vectors back to those of the original matrix.

The black box functions in this chapter which compute eigenvectors perform both forms of balancing.

Eigenvectors, as defined by equations (1) or (4), are not uniquely defined. If x$x$ is an eigenvector, then so is kx$kx$ where k$k$ is any nonzero scalar. Eigenvectors computed by different algorithms, or on different computers, may appear to disagree completely, though in fact they differ only by a scalar factor (which may be complex). These differences should not be significant in any application in which the eigenvectors will be used, but they can arouse uncertainty about the correctness of computed results.

Even if eigenvectors x$x$ are normalized so that ‖x‖_{2} = 1${\Vert x\Vert}_{2}=1$, this is not sufficient to fix them uniquely, since they can still be multiplied by a scalar factor k$k$ such that |k| = 1$\left|k\right|=1$. To counteract this inconvenience, most of the functions in this chapter, and in Chapter F08, normalize eigenvectors (and Schur vectors) so that ‖x‖_{2} = 1${\Vert x\Vert}_{2}=1$ and the component of x$x$ with largest absolute value is real and positive. (There is still a possible indeterminacy if there are two components of equal largest absolute value – or in practice if they are very close – but this is rare.)

In symmetric problems the computed eigenvalues are sorted into ascending order, but in nonsymmetric problems the order in which the computed eigenvalues are returned is dependent on the detailed working of the algorithm and may be sensitive to rounding errors. The Schur form and Schur vectors depend on the ordering of the eigenvalues and this is another possible cause of non-uniqueness when they are computed. However, it must be stressed again that variations in the results from this cause should not be significant. (Functions in Chapter F08 can be used to transform the Schur form and Schur vectors so that the eigenvalues appear in any given order if this is important.)

In singular value problems, the left and right singular vectors u$u$ and v$v$ which correspond to a singular value σ$\sigma $ cannot be normalized independently: if u$u$ is multiplied by a factor k$k$ such that |k| = 1$\left|k\right|=1$, then v$v$ must also be multiplied by k$k$.

Non-uniqueness also occurs among eigenvectors which correspond to a multiple eigenvalue, or among singular vectors which correspond to a multiple singular value. In practice, this is more likely to be apparent as the extreme sensitivity of eigenvectors which correspond to a cluster of close eigenvalues (or of singular vectors which correspond to a cluster of close singular values).

The decision tree for this section is divided into three sub-trees.

Is this a sparse eigenproblem Ax = λx$Ax=\lambda x$ or Ax = λBx$Ax=\lambda Bx$? | _ yes |
Is the problem symmetric? | _ yes |
nag_eigen_real_symm_sparse_eigsys (f02fj) | ||

| | no | |
|||||

| | nag_eigen_real_gen_sparse_arnoldi (f02ek) | |||||

no | |
||||||

Is the eigenproblem Ax = λBx$Ax=\lambda Bx$? | _ yes |
Are A$A$ and B$B$ symmetric with B$B$ positive definite and well-conditioned w.r.t inversion? | _ yes |
Are A$A$ and B$B$ band matrices? | _ yes |
nag_lapack_dsbgv (f08ua), nag_lapack_dsbgvx (f08ub) or nag_sparseig_real_symm_band_init (f12ff) and nag_sparseig_real_band_solve (f12ag) |

| | | | no | |
||||

| | | | nag_lapack_dsygv (f08sa) or nag_lapack_dsygvx (f08sb) | ||||

| | no | |
|||||

| | Are A$A$ and B$B$ band matrices? | _ yes |
nag_sparseig_real_band_init (f12af) and nag_sparseig_real_band_solve (f12ag) | |||

| | no | |
|||||

| | Is the generalized Schur factorization required? | _ yes |
nag_lapack_dgges (f08xa) | |||

| | no | |
|||||

| | nag_lapack_dggev (f08wa) or nag_lapack_dggevx (f08wb) | |||||

no | |
||||||

The eigenproblem is Ax = λx$Ax=\lambda x$. Is A$A$ symmetric? | _ yes |
Are all eigenvalues or all eigenvectors required? | _ yes |
nag_lapack_dsyev (f08fa) | ||

| | no | |
|||||

| | nag_lapack_dsyevx (f08fb) | |||||

no | |
||||||

Are eigenvalues only required? | _ yes |
nag_lapack_dgeev (f08na) or nag_lapack_dgeevx (f08nb) | ||||

no | |
||||||

Is the Schur factorization required? | _ yes |
nag_lapack_dgees (f08pa) or nag_lapack_dgeesx (f08pb) | ||||

no | |
||||||

Are all eigenvectors required? | _ yes |
nag_lapack_dgeev (f08na) or nag_lapack_dgeevx (f08nb) | ||||

no | |
||||||

nag_eigen_real_gen_eigsys (f02ec) |

Is this a sparse eigenproblem Ax = λx$Ax=\lambda x$ or Ax = λBx$Ax=\lambda Bx$? | _ yes |
Are A$A$ and B$B$ banded matrices? | _ yes |
nag_sparseig_complex_band_init (f12at) and nag_sparseig_complex_band_solve (f12au) |

| | no | |
|||

| | Chapter F12 | |||

no | |
||||

Is the eigenproblem Ax = λBx$Ax=\lambda Bx$? | _ yes |
Are A$A$ and B$B$ Hermitian with B$B$ positive definite and well-conditioned w.r.t. inversion? | _ yes |
nag_lapack_zhbgv (f08un) or nag_lapack_zhbgvx (f08up) |

| | no | |
|||

| | Is the generalized Schur factorization required? | _ yes |
nag_lapack_zgges (f08xn) | |

| | no | |
|||

| | nag_lapack_zggev (f08wn) | |||

no | |
||||

The eigenproblem is Ax = λx$Ax=\lambda x$. Is A$A$ Hermitian? | _ yes |
Are all eigenvalues and eigenvectors required? | _ yes |
nag_lapack_zheev (f08fn) or nag_lapack_zheevx (f08fp) |

| | no | |
|||

| | nag_lapack_zheevx (f08fp) | |||

no | |
||||

Are eigenvalues only required? | _ yes |
nag_lapack_zgeev (f08nn) or nag_lapack_zgeevx (f08np) | ||

no | |
||||

Is the Schur factorization required? | _ yes |
nag_lapack_zgees (f08pn) or nag_lapack_zgeesx (f08pp) | ||

no | |
||||

Are all eigenvectors required? | _ yes |
nag_lapack_zgeev (f08nn) or nag_lapack_zgeevx (f08np) | ||

no | |
||||

nag_eigen_complex_gen_eigsys (f02gc) |

Is A$A$ a complex matrix? | _ yes |
Is A$A$ upper triangular? | _ yes |
nag_eigen_complex_triang_svd (f02xu) |

| | no | |
|||

| | nag_lapack_zgesvd (f08kp) | |||

no | |
||||

Is A$A$ upper triangular? | _ yes |
nag_eigen_real_triang_svd (f02wu) | ||

no | |
||||

Are only the leading terms required? | _ yes |
nag_eigen_real_gen_partialsvd (f02wg) | ||

no | |
||||

nag_lapack_dgesvd (f08kb) |

Functions for large sparse eigenvalue problems are to be found in Chapter F12, see the F12 Chapter Introduction.

The decision tree for this section addressing dense problems, is divided into eight sub-trees:

- Tree 1 Real Symmetric Eigenvalue Problems in the F08 Chapter Introduction
- Tree 2 Real Generalized Symmetric-definite Eigenvalue Problems in the F08 Chapter Introduction
- Tree 3 Real Nonsymmetric Eigenvalue Problems in the F08 Chapter Introduction
- Tree 4 Real Generalized Nonsymmetric Eigenvalue Problems in the F08 Chapter Introduction
- Tree 5 Complex Hermitian Eigenvalue Problems in the F08 Chapter Introduction
- Tree 6 Complex Generalized Hermitian-definite Eigenvalue Problems in the F08 Chapter Introduction
- Tree 7 Complex non-Hermitian Eigenvalue Problems in the F08 Chapter Introduction
- Tree 8 Complex Generalized non-Hermitian Eigenvalue Problems in the F08 Chapter Introduction

As it is very unlikely that one of the functions in this section will be called on its own, the other functions required to solve a given problem are listed in the order in which they should be called.

See Section [General Purpose s (singular value decomposition)] in the F08 Chapter Introduction. For real sparse matrices where only selected singular values are required (possibly with their singular vectors), functions from Chapter F12 may be applied to the symmetric matrix A^{T}A${A}^{\mathrm{T}}A$; see Section [Example] in (f12fb).

A − λB |

m by n matrix (m ≥ n), QR factorization and SVD |

m by n matrix, leading terms SVD |

Anderson E, Bai Z, Bischof C, Blackford S, Demmel J, Dongarra J J, Du Croz J J, Greenbaum A, Hammarling S, McKenney A and Sorensen D (1999) *LAPACK Users' Guide* (3rd Edition) SIAM, Philadelphia

Golub G H and Van Loan C F (1996) *Matrix Computations* (3rd Edition) Johns Hopkins University Press, Baltimore

Parlett B N (1998) *The Symmetric Eigenvalue Problem* SIAM, Philadelphia

Wilkinson J H and Reinsch C (1971) *Handbook for Automatic Computation II, Linear Algebra* Springer–Verlag

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013