Accurate eigenvalue decomposition of arrowhead matrices and applications
N. Jakovˇcevi´cStora,1,∗, I. Slapniˇcara,1, J. Barlowb,2
aFaculty of Electrical Engineering, Mechanical Engineering and Naval Architecture, University of Split, Rudjera Boˇskovi´ca32, 21000 Split, Croatia bDepartment of Computer Science and Engineering, The Pennsylvania State University, University Park, PA 16802-6822, USA
Abstract We present a new algorithm for solving an eigenvalue problem for a real sym- metric arrowhead matrix. The algorithm computes all eigenvalues and all com- ponents of the corresponding eigenvectors with high relative accuracy in O(n2) operations. The algorithm is based on a shift-and-invert approach. Double precision is eventually needed to compute only one element of the inverse of the shifted matrix. Each eigenvalue and the corresponding eigenvector can be computed separately, which makes the algorithm adaptable for parallel com- puting. Our results extend to Hermitian arrowhead matrices, real symmetric diagonal-plus-rank-one matrices and singular value decomposition of real trian- gular arrowhead matrices. Keywords: eigenvalue decomposition, arrowhead matrix, high relative accuracy, singular value decomposition 2000 MSC: 65F15
1. Introduction and Preliminaries
In this paper we consider eigenvalue problem for a real symmetric matrix A which is zero except for its main diagonal and one row and column. Since eigenvalues are invariant under similarity transformations, we can symmetrically permute the rows and the columns of the given matrix. Therefore, we assume without loss of generality that the matrix A is a n×n real symmetric arrowhead matrix of the form
∗Corresponding author Email addresses: [email protected] (N. Jakovˇcevi´cStor), [email protected] (I. Slapniˇcar), [email protected] (J. Barlow) 1The research of Ivan Slapniˇcarand Nevena Jakovˇcevi´cStor was supported by the Ministry of Science, Education and Sports of the Republic of Croatia under grant 023-0372783-1289. 2The research of Jesse L. Barlow was supported by the National Science Foundation under grant CCF-1115704.
Preprint submitted to Elsevier March 1, 2013 D z A = , (1) zT α where D = diag(d1, d2, . . . , dn−1) is diagonal matrix of order n − 1,
T z = ζ1 ζ2 ··· ζn−1 (2) is a vector and α is a scalar. Such matrices arise in the description of radiationless transitions in isolated molecules [3], oscillators vibrationally coupled with a Fermi liquid [8], quantum optics [15] (see also Example 4). Such matrices also arise in solving symmetric real tridiagonal eigenvalue problems with the divide-and-conquer method [11]. In this paper we present an algorithm which computes all eigenvalues and all components of the corresponding eigenvectors with high relative accuracy in O(n2) operations. Without loss of generality we may assume that A is irreducible, that is,
ζi 6= 0, for all i and di 6= dj, for all i 6= j, i, j = 1, . . . , n − 1.
If A has a zero in the last column, say ζi = 0, then the diagonal element di is an eigenvalue whose corresponding eigenvector is the i-th unit vector, and we can reduce the size of the problem by deleting the i-th row and column of the matrix, eventually obtaining a matrix for which all elements ζj are nonzero. If di = dj, then di is eigenvalue of matrix A (this follows from the interlacing property (7)), and we can reduce the size of the problem by annihilating ζj with a Givens rotation in the (i, j)-plane and proceeding as in the previous case. Further, by symmetric row and column pivoting, we can order elements of D such that d1 > d2 > ··· > dn−1. (3) Hence, we will consider only ordered and irreducible arrowhead matrices. With- out loss of generality we can also assume that ζi > 0 for all i, which can be at- tained by pre- and post-multiplication of the matrix A with D = diag(sign(ζi))). Let A = V ΛV T (4) be the eigenvalue decomposition of A. Here
Λ = diag(λ1, λ2, . . . , λn) is a diagonal matrix whose diagonal elements are the eigenvalues of A, and V = v1 ··· vn
2 is an orthonormal matrix whose columns are the corresponding eigenvectors. The eigenvalues of A are the zeros of the Pick function (see [4, 16])
n−1 X ζ2 f(λ) = α − λ − i = α − λ − zT (D − λI)−1z, (5) d − λ i=1 i and the corresponding eigenvectors are given by
−1 xi (D − λiI) z vi = , xi = , i = 1, . . . , n. (6) kxik2 −1
Diagonal elements of the matrix D, di, are called poles of the function f. Notice that (3) and the Cauchy interlacing theorem [10, Theorem 8.1.7] applied to matrices D and A imply the interlacing property
λ1 > d1 > λ2 > d2 > ··· > dn−2 > λn−1 > dn−1 > λn. (7)
Since A is symmetric, its eigenvalues may be computed by invoking any of a number of standard programs (LAPACK [1]). However, these programs usually begin with an initial reduction of the matrix to tridiagonal form [17], or as proposed in [16], with an alternative which takes advantage of the structure of A by finding the zeros of the Pick function given in (5), for the eigenvalues of A. This results in an algorithm which requires only O(n2) computations and O(n) storage. Although the idea is conceptually simple and in fact has been used to solve other eigenvalue problems of special structure [2, 5, 6, 7], the computation is not always stable [11]. Namely, if the computed eigenvalues λi are not accurate enough, then the computed eigenvectors vi may not be sufficiently orthogonal (see Example 3). The existing algorithms for arrowhead matrices [11, 16] obtain orthogonal eigenvectors with the following procedure: ˜ - compute the eigenvalues λi of A by solving (5); - construct a new matrix D z˜ A˜ = z˜T α˜ by solving inverse problem with the prescribed eigenvalues λ˜, and diagonal matrix D, that is, compute newz ˜ andα ˜ as
v u i ˜ n−1 ˜ u Y λj − di Y λj − di ζ˜ = u d − λ˜ λ˜ − d , i t i n 1 i (d − d ) (d − d ) j=2 j−1 i j=i+1 j i
n−1 ˜ X ˜ α˜ = λn + λj − dj . j=1
- compute eigenvectors of A˜ by (6).
3 ˜ Since the formulas for ζi involve only multiplications, division and subtrac- tions of exact quantities, each ζi is computed with relative error of O(εM ), 3 where εM denotes the machine precision. Therefore, A˜ = A + δA, where kδAk2 = O(M ). Here k · k2 denotes the spectral matrix norm. We conclude ˜ that the computed eigenvalues λi satisfy standard perturbation bounds like ˜ those from [10, Corollary 8.1.6]. Further, since λi are the eigenvalues of the matrix A˜ computed to higher relative accuracy, the eigenvectors computed by (6) are orthogonal to machine precision. For details see [11, 16]. Our algorithm uses a different approach. Accuracy of the eigenvectors and their orthogonality follows from high relative accuracy of the computed eigen- values and there is no need for follow-up orthogonalization. The algorithm is based on shift-and-invert technique. Basically, the eigenvalue λ is computed as the largest or the smallest eigenvalue of the inverse of the matrix shifted to the pole di which is nearest to λ, that is, 1 λ = + d , (8) ν i where ν is either smallest or largest eigenvalue of the matrix
−1 −1 Ai ≡ (A − diI) . Inverses of arrowhead matrices are structured in the following manner (here × stands for non-zero element): the inverse of an arrowhead matrix with zero on the shaft is a permuted arrowhead matrix with zero on the shaft,
−1 × × × × × × × × 0 × = × × × × × , × × × × × × × × × × 0 and the inverse of the full arrowhead matrix is a diagonal-plus-rank-one (DPR1) matrix,
−1 × × × × × × T × × = × ± uu . × × × × × × × × 0
3 The machine precision εM is defined as a smallest positive number such that in the floating-point arithmetic 1 + εM 6= 1. In Matlab or FORTRAN REAL(8) arithmetic εM = 2.2204 · 10−16, thus the floating-point numbers have approximately 16 significant decimal digits. The term “double of the working precision” means that the computations are performed with numbers having approximately 32 significant decimal digits, or with the machine precision 2 equal to εM .
4 Our algorithm is completely parallel, since the computation of one eigen- value and its eigenvector is completely independent of the computation of other eigenvalues and eigenvectors. In Section 2 we describe the basic idea of our algorithm named aheig (Ar- rowHead EIGenvalues). In Section 3 we discuss the accuracy of the algorithm. In Section 4 we present the complete algorithm which uses double of the working precision, if necessary. In Section 5 we illustrate algorithm with few examples and in Section 6 we apply our results to eigenvalue decomposition of Hermitian arrowhead matrix, singular value decomposition of real triangular arrowhead matrix and eigenvalue decomposition of real symmetric diagonal-plus-rank-one matrix. The proofs are given in Appendix A.
2. Basic shift-and-invert algorithm
Let λ be an eigenvalue of A, let v be its eigenvector, and let x be the unnormalized version of v from (6). Let di be the pole which is closest to λ. Clearly, from (7) it follows that either λ = λi or λ = λi+1. Let Ai be the shifted matrix D1 0 0 z1 0 0 0 ζi Ai = A − diI = , (9) 0 0 D2 z2 T T z1 ζi z2 a where
D1 = diag(d1 − di, . . . , di−1 − di),
D2 = diag(di+1 − di, . . . , dn−1 − di), T z1 = ζ1 ζ2 ··· ζi−1 , T z2 = ζi+1 ζi+2 ··· ζn−1 ,
a = α − di.
Notice that D1 (D2) is positive (negative) definite. Obviously, if λ is an eigenvalue of A, then
µ = λ − di is an eigenvalue of Ai, and vice versa, and they both have the same eigenvector. The inverse of Ai is
−1 D1 w1 0 0 T T −1 w1 b w2 1/ζi Ai = −1 , (10) 0 w2 D2 0 0 1/ζi 0 0
5 where
−1 1 w1 = −D1 z1 , ζi −1 1 w2 = −D2 z2 , ζi 1 T −1 T −1 b = 2 −a + z1 D1 z1 + z2 D2 z2 . (11) ζi Notice that ¯ 2 b = f (di) /ζi where ¯ T −1 f (di) = α − di − z¯ D¯ − diI z¯ where D¯ is the diagonal matrix D without di andz ¯ is z without ζi. The eigenvector x from (6) is given by
−1 (D1 − µI) z1 x1 ζ − i . x = . = µ . (12) (D − µI)−1 z xn 2 2 −1
If λ is an eigenvalue of A which is closest to the pole di, then µ is the eigenvalue of matrix Ai which is closest to zero and
1 −1 ν = = ± A . µ i 2
−1 In this case, if all entries of Ai are computed with high relative accuracy, then, according to standard perturbation theory, ν is computed to high relative accuracy (by any reasonable algorithm). In Section 3 we show that all entries −1 of Ai are indeed computed to high relative accuracy, except possibly b (see −1 (11)). If b is not computed to high relative accuracy and it influences Ai 2, it is sufficient to compute it in double of the working precision (see Section 4). Further, if µ is not the eigenvalue of Ai which is closest to zero, then |ν| < −1 Ai 2, and the quantity −1 A K = i 2 (13) ν |ν| −1 tells us how far is ν from the absolutely largest eigenvalue of Ai . If Kν 1, then the standard perturbation theory does not guarantee that the eigenvalue µ will be computed with high relative accuracy. Remedies of this situation are described in Remark 2. Finally, the exterior eigenvalues λ1 and λn of A are excluded from the above reasoning. The absolutely larger of those is equal to kAk2 and is, according to standard perturbation theory, computed with high relative accuracy. The
6 other exterior eigenvalue can also be computed with high relative accuracy if it is of the same order of magnitude as the larger one. If this is not the case, the absolutely smaller eigenvalue is computed as interior eigenvalues of A. With this approach the componentwise high relative accuracy of the eigen- vectors computed by (12) follows from high relative accuracy of the computed eigenvalues (see Theorem 3). Componentwise high relative accuracy of the com- puted eigenvectors implies, in turn, their orthogonality. The described procedure is implemented in algorithm aheig basic (Algo- −1 rithm 1). The computation of the inverse of the shifted matrix, Ai , according to formulas (10) and (11), is implemented in Algorithm 2. Algorithm 3 com- putes the largest or the smallest zero of the Pick function (5) by bisection. Given eigenvalue λ, Algorithm 4 computes the corresponding eigenvector by (6) or (12), respectively.
3. Accuracy of the algorithm
We now consider numerical properties of Algorithms 1, 2, 3, and 4. We assume tha standard model of floating point arithmetic where subtraction is preformed with guard digit, such that [9, 18, 10, 19]
fl(a ◦ b) = (a ◦ b)(1 + ε◦), |ε◦| ≤ εM , ◦ ∈ {+, −, ∗,/}, where εM is machine precision. In the statements of the theorems and their proofs we shall use the standard first order approximations, that is, we neglect 2 the terms of order O(εM ) or higher. Moreover, we assume that neither overflow or underflow occurs during the computation. We shall use the following notation:
Matrix Exact eigenvalue Computed eigenvalue A λ λe Ai µ − (14) Aei = fl(Ai) µb µe = fl(µb) −1 Ai ν − ^−1 −1 (Ai ) = fl(Ai ) νb νe = fl(νb) Here D1 (I + E1) 0 0 z1 0 0 0 ζi Aei = fl (Ai) = , 0 0 D2 (I + E2) z2 T T z1 ζi z2 a (1 + εa) where E1 and E2 are diagonal matrices whose elements are bounded by εM in absolute values and |εa| ≤ εM .
7 Algorithm 1 [λ, v] = aheig basic (D, z, α, k) % Computes the k-th eigenpair of an irreducible arrowhead matrix % A = [diag (D) z; z0 α] n = max(size(D)) + 1 % Set the shift index i initially to zero i = 0 % Compute exterior eigenvalue (k = 1 or k = n) if k == 1 λ = bisect(D, z, α, 0R0) 0 0 λn = bisect(D, z, α, L ) if |λn/λ| < 10 % the eigenvalue is accurate v = vect(D, z, λ) else % determine the shift σ, the shift index i, and whether λ is on the left % or the right side of the nearest pole σ = d1 i = 1 side = 0R0 end elseif k == n λ = bisect(D, z, α, 0L0) 0 0 λ1 = bisect(D, z, α, R ) if |λ1/λ| < 10 % the eigenvalue is accurate v = vect(D, z, λ) else % determine the shift, shift index, and side σ = dn−1 i = n − 1 side = 0L0 end
8 Algorithm 1 (Continued) else % Compute interior eigenvalue (k ∈ {2, . . . , n − 1}) % Determine the shift (the nearest pole) and the shift index Dtemp = D − dk atemp = α − dk middle = Dtempk−1/2 F middle = atemp − middle − P(z2./(Dtemp − middle)) if F middle < 0 σ = dk i = k side = 0R0 else σ = dk−1 i = k − 1 side = 0L0 end end if i 6= 0 −1 % Compute the inverse of the shifted matrix, Ai [invD1, invD2, w1, w2, wζ , b] = invA(D, z, α, i) −1 % Compute the leftmost or the rightmost eigenvalue of Ai ν = bisect([invD1; 0; invD2], [w1; wζ ; w2], b, side) % Compute the corresponding eigenvector µ = 1/ν v = vect(D − σ, z, µ) % Shift the eigenvalue back λ = µ + σ end
Algorithm 2
[invD1, invD2, w1, w2, wζ , b] = invA (D, z, α, i) 0 % Computes the inverse of an arrowhead matrix A = [diag(D − di) z; z α − di] % according to (10) and (11). n = max(size(D)) + 1 D = D − di a = α − di w1 = −z1:i−1./D1:i−1/zi w2 = −zi+1:n−1./Di+1:n−1/zi wζ = 1/zi invD1 = 1./D1:i−1 invD2 = 1./Di+1:n−1 b = (−a + sum(z1:i−1.^2./D1:i−1) + sum(zi+1:n−1.^2./Di+1:n−1))/zi^2
9 Algorithm 3 λ = bisect (D, z, α, side) % Computes the leftmost (for side=’L’) or the rightmost (for side=’R’) eigenvalue % of an arrowhead matrix A = [diag (D) z; z0 α] by bisection. n = max(size(D)) + 1 % Determine the starting interval for bisection, [left, right] if side == 0L0 left = min{D − |z|, α − kzk1} right = min di else right = max{D + |z|, α + kzk1} left = max di end % Bisection middle = (left + right)/2 while (right − left)/abs(middle) > 2 ∗ eps F middle = α − middle − sum(z.^2./ (D − middle)) if F middle > 0 left = middle else right = middle end middle = (left + right)/2 end % Eigenvalue λ = right
Algorithm 4 v = vect (D, z, λ) % Computes the eigenvector of an arrowhead matrix A = [diag(D) z; z0 α] % which corresponds to the eigenvalue λ by using (6). v = [z./(D − λ); −1] v = v/kvk2
10 Further we define the quantities κλ, κµ and κb as follows:
λe = fl (λ) = λ (1 + κλεM ) , (15) µe = fl (µ) = µ (1 + κµεM ) , (16) eb = fl (b) = b (1 + κbεM ) . (17) We also define the quantity
T −1 T −1 |a| + z D z1 + z D z2 K = 1 1 2 2 . (18) b T −1 T −1 −a + z1 D1 z1 + z2 D2 z2
3.1. Connection between accuracy of λ and µ Let λ = µ + di be an eigenvalue of the matrix A, where µ is the corresponding eigenvalue of the shifted matrix Ai = A − di from which λ is computed. Let
λe = fl(µe + di) be the computed eigenvalue. Theorem 1 gives us dependency of accuracy of λe in (15) upon accuracy of µe in (16).
Theorem 1. For λ and λe from (15) and µ and µe from (16) we have |d | + |µ| |κ | ≤ i (|κ | + 1) . (19) λ |λ| µ Proofs of this theorem and subsequent theorems are given in Appendix A. From Theorem 1 we see that the accuracy of λe depends on κµ and the size of the quotient |d | + |µ| i . (20) |λ| Theorem 2 analyzes the quotient (20) with respect to the position of λ and signs of µ and the neighboring poles. Theorem 2. Let the assumptions of Theorem 1 hold.
(i) If (see Figure 1 (i)) sign (di) = sign (µ) , then |d | + |µ| i = 1. |λ|
(ii) If λ is between two poles of the same sign and sign (di) 6= sign (µ) (see Figure 1 (ii)), then |d | + |µ| i ≤ 3. |λ|
11 µ µ z}|{ z}|{
s s di+1 λ di 0 di λ di−1 0 (i) (ii)
Figure 1: Typical situations from Theorem 2
Theorem 2 does not cover the following cases:
(a) If d1 < 0, then µ > 0. If, further, |d1| ≈ |µ|, then λ1 is near zero, and 4 (|d1| + |µ|)/ |λ1| 1 (see Figure 2 (a)).
(b) If dn > 0, then µ < 0. If, further, |dn| ≈ |µ|, then λn is near zero, and 5 again (|dn| + |µ|)/ |λn| 1.
(c) If λ is between two poles of the different signs and sign (di) 6= sign (µ), then either di+1 < 0 < di and µ < 0, or di < 0 < di−1 and µ > 0. In both cases, if, additionally, |di| ≈ |µ|, then λ is near zero, and (|di|+|µ|)/ |λ| 1 (see Figure 2 (c)).
µ µ z }| { z }| {
s s d1 λ1 0 di+1 0 λ di (a) (c)
Figure 2: Typical situations for special cases
Since only one of these three cases can occur, Theorems 1 and 2 imply that for all eigenvalues λ ∈ σ (A), but eventually one, it holds
|d | + |µ| i ≤ 3. |λ|
If one of the above cases does occur, remedies are given in the following remark. Remark 1. If one of the cases (a), (b) or (c) occurs, then λ is an eigenvalue of A nearest to zero, and we can accurately compute it from the inverse of A.
4 In this case λ1 is computed as a difference of two close quantities and cancellation can occur. 5 In this case λn is computed as a difference of two close quantities and cancellation can occur.
12 Notice that the inverse is of an unreduced arrowhead matrix with non-zero shaft is a diagonal-plus-rank-one (DPR1) matrix of the form
D−1 A−1 = + ρuuT , 0 where T 1 u = zT D−1 −1 , ρ = . a − zT D−1z Eigenvalues of A−1 are zeros of (see [2, 14])
n 2 X uj ϕ (λ) = 1 + ρ . d − λ j=1 j
Since the absolutely largest eigenvalue of A−1 is computed accurately according −1 to standard perturbation theory, and 1/|λ| = kA k2, λ is also computed with high relative accuracy. In computing matrix A−1, eventually ρ needs to be computed in higher precision. For more details see Remark 2.
We still need to bound the quantity κµ from (19). This quantity essentially depends on the accuracy of fl(b). The bound for κµ is given in Theorem 6.
3.2. Accuracy of the eigenvectors Since the eigenvector is computed by (12), its accuracy depends on the ac- curacy of µe as described by the following theorem: Theorem 3. Let (16) hold and let
−1 x1 (D1 (I + E1) − µIe ) z1 e ζ . i . − xe = = fl( µe ) (21) −1 (D2 (I + E2) − µIe ) z2 xen −1 be the computed un-normalized eigenvector corresponding to µ and λ. Then
x = x 1 + ε , ε ≤ 3 (|κ | + 3) ε , j = 1, . . . , n. ej j xj xj µ M
In other words, if κµ is small, then all components of the eigenvector are computed to high relative accuracy. Since the accuracy of λe and xe depends on the accuracy of µe (on the size of κµ) in the next three subsections tells we discuss the accuracy of µ. Since µ is computed as an inverse of the eigenvalue −1 e e of the matrix fl(Ai ), we first discuss the accuracy of that matrix.
13 −1 3.3. Accuracy of the matrix Ai We have the following theorem: −1 Theorem 4. For the computed elements of the matrix Ai from (10) and (11) for all (j, k) 6= (i, i) we have