Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Lecture Notes on Solving Large Scale Eigenvalue Problems.pdf
Скачиваний:
49
Добавлен:
22.03.2016
Размер:
2.32 Mб
Скачать

10.4. THE GENERALIZED EIGENVALUE PROBLEM

181

According to an earlier theorem we know that if λ σ(A) is simple and ϑ is the eigenvalue of A + E closest to λ, then

(10.6)

|

λ

ϑ

| ≤

kEk

+

(

E

2).

y x

 

 

 

 

O k

k

 

Here, y and x are left and right eigenvectors of E corresponding to the eigenvalue λ. A similar statement holds for the eigenvectors, but the distance (gap) to the next eigenvalue comes into play as well.

In ARPACK, a Ritz pair (ϑ, ) is considered converged if

(10.7)

βm|ems| ≤ max(εM kHmk, tol · |ϑ|).

As |ϑ| ≤ kHmk ≤ kAk, the inequality kEk ≤ tol · kAk holds at convergence. According to (10.6) well-conditioned eigenvalues are well approximated.

10.4The generalized eigenvalue problem

Let us consider now the generalized eigenvalue problem

(10.8) Ax = λMx.

Applying a shift-and-invert spectral transformation with shift σ transforms (10.8) into

(10.9)

Sx = (A − σM)−1Mx = µx, µ =

 

1

 

.

 

 

 

λ

σ

 

 

 

 

 

We now execute an Arnoldi/Lanczos iteration with S to obtain

 

 

(10.10)

SQm = QmHm + rmem, QmMQm = Im,

 

QmMrm = 0.

Let s with ksk = 1 be an eigenvector of Hm with Ritz value ϑ. Let y = Qms be the associated Ritz vector. Then,

(10.11)

SQms = Sy = QmHms + rmems = yϑ + rmems.

So, yϑ+rmems can be considered a vector that is obtained by one step of inverse iteration. This vector is an improved approximation to the desired eigenvector, obtained at negligible cost. This so-called eigenvector purification is particularly important if M is singular.

Let us bound the residual norm of the purified vector. With (10.11) we have

(10.12)

My = (A

σM)(yϑ + r

 

 

 

e

s)

 

 

|

 

 

m m

 

 

 

 

 

{z

 

 

 

 

 

 

}

 

 

 

 

 

 

 

with

kkM = q

 

 

 

 

 

 

 

 

 

 

 

 

ϑ2 + βk2|ems|2

.

 

 

This equality holds as y M r. By consequence,

 

 

 

 

 

 

 

 

 

 

kA− λMk = k(A − σM)+ M(σ − λ)k

(10.13)

 

 

 

 

 

|

 

{z

 

}

 

 

 

 

 

 

 

 

ϑ1

 

= kMy − M(yϑ + rmems)/ϑk = kMrk |ems|/|ϑ|.

Since |ϑ| is large in general, we obtain good bounds for the residual of the purified eigenvectors.

182 CHAPTER 10. RESTARTING ARNOLDI AND LANCZOS ALGORITHMS

EIGS

Find a few eigenvalues and eigenvectors of a matrix using ARPACK

D

= EIGS(A) returns a vector of A’s 6 largest magnitude eigenvalues.

A

must be square and should be large and sparse.

[V,D] = EIGS(A) returns a diagonal matrix D of A’s 6 largest magnitude eigenvalues and a matrix V whose columns are the corresponding eigenvectors.

[V,D,FLAG] = EIGS(A) also returns a convergence flag. If FLAG is 0 then all the eigenvalues converged; otherwise not all converged.

EIGS(A,B) solves the generalized eigenvalue problem A*V == B*V*D. B must be symmetric (or Hermitian) positive definite and the same size as A. EIGS(A,[],...) indicates the standard eigenvalue problem A*V == V*D.

EIGS(A,K) and EIGS(A,B,K) return the K largest magnitude eigenvalues.

EIGS(A,K,SIGMA) and EIGS(A,B,K,SIGMA) return K eigenvalues. If SIGMA is: ’LM’ or ’SM’ - Largest or Smallest Magnitude

For real symmetric problems, SIGMA may also be: ’LA’ or ’SA’ - Largest or Smallest Algebraic

’BE’ - Both Ends, one more from high end if K is odd For nonsymmetric and complex problems, SIGMA may also be:

’LR’ or ’SR’ - Largest or Smallest Real part

’LI’ or ’SI’ - Largest or Smallest Imaginary part

If SIGMA is a real or complex scalar including 0, EIGS finds the eigenvalues closest to SIGMA. For scalar SIGMA, and when SIGMA = ’SM’, B need only be symmetric (or Hermitian) positive semi-definite since it is not Cholesky factored as in the other cases.

EIGS(A,K,SIGMA,OPTS) and EIGS(A,B,K,SIGMA,OPTS) specify options: OPTS.issym: symmetry of A or A-SIGMA*B represented by AFUN [{false} | true]

OPTS.isreal: complexity of A or A-SIGMA*B represented by AFUN [false | {true}] OPTS.tol: convergence: Ritz estimate residual <= tol*NORM(A) [scalar | {eps}] OPTS.maxit: maximum number of iterations [integer | {300}]

OPTS.p: number of Lanczos vectors: K+1<p<=N [integer | {2K}] OPTS.v0: starting vector [N-by-1 vector | {randomly generated}] OPTS.disp: diagnostic information display level [0 | {1} | 2]

OPTS.cholB: B is actually its Cholesky factor CHOL(B) [{false} | true] OPTS.permB: sparse B is actually CHOL(B(permB,permB)) [permB | {1:N}] Use CHOL(B) instead of B when SIGMA is a string other than ’SM’.

EIGS(AFUN,N) accepts the function AFUN instead of the matrix A. AFUN is a function handle and Y = AFUN(X) should return

A*X

if SIGMA is

unspecified, or a string other than ’SM’

A\X

if SIGMA is

0

or ’SM’

(A-SIGMA*I)\X

if

SIGMA is

a nonzero scalar (standard problem)

(A-SIGMA*B)\X

if

SIGMA is

a

nonzero scalar (generalized problem)

N is the size of A. The matrix A, A-SIGMA*I or A-SIGMA*B represented by AFUN is assumed to be real and nonsymmetric unless specified otherwise by OPTS.isreal and OPTS.issym. In all these EIGS syntaxes, EIGS(A,...) may be replaced by EIGS(AFUN,N,...).

Example:

A = delsq(numgrid(’C’,15)); d1 = eigs(A,5,’SM’);

Equivalently, if dnRk is the following one-line function: %----------------------------%

function y = dnRk(x,R,k)

y = (delsq(numgrid(R,k))) \ x;

%----------------------------

%

n = size(A,1);

opts.issym = 1;

d2 = eigs(@(x)dnRk(x,’C’,15),n,5,’SM’,opts);

See also eig, svds, ARPACKC, function_handle.

10.5. A NUMERICAL EXAMPLE

183

10.5A numerical example

This example is taken from the MATLAB document pages regarding eigs. eigs is the MATLAB interface to the ARPACK code, see page 182. The matrix called west0479 is a 479×479 matrix originating in a chemical engineering plant model. The matrix is available from the Matrix Market [5], a web site that provides numerous test matrices. Its nonzero structure is given in Fig. 10.1

479x479 Matrix west0479 0

50

100

150

200

250

300

350

400

450

0

100

200

300

400

 

 

nnz = 1887

 

 

Figure 10.1: Nonzero structure of the 479 × 479 matrix west0479

To compute the eight largest eigenvalues of this matrix we issue the following MATLAB commands.

>>load west0479

>>d = eig(full(west0479));

>>dlm=eigs(west0479,8);

Iteration 1: a few Ritz values of the 20-by-20 matrix: 0 0 0 0 0 0 0 0 0

Iteration 2: a few Ritz values of the 20-by-20 matrix: 1.0e+03 *

-0.0561 - 0.0536i

184 CHAPTER 10. RESTARTING ARNOLDI AND LANCZOS ALGORITHMS

0.1081 + 0.0541i

0.1081 - 0.0541i -0.1009 - 0.0666i -0.1009 + 0.0666i -0.0072 + 0.1207i -0.0072 - 0.1207i 0.0000 - 1.7007i 0.0000 + 1.7007i

Iteration 3: a few Ritz values of the 20-by-20 matrix: 1.0e+03 *

-0.0866

-0.1009 - 0.0666i -0.1009 + 0.0666i -0.0072 + 0.1207i -0.0072 - 0.1207i 0.1081 - 0.0541i 0.1081 + 0.0541i 0.0000 - 1.7007i 0.0000 + 1.7007i

Iteration 4: a few Ritz values of the 20-by-20 matrix: 1.0e+03 *

0.0614 - 0.0465i -0.0072 - 0.1207i -0.0072 + 0.1207i 0.1081 + 0.0541i 0.1081 - 0.0541i -0.1009 + 0.0666i -0.1009 - 0.0666i 0.0000 - 1.7007i 0.0000 + 1.7007i

Iteration 5: a few Ritz values of the 20-by-20 matrix: 1.0e+03 *

-0.0808

-0.0072 + 0.1207i -0.0072 - 0.1207i -0.1009 - 0.0666i -0.1009 + 0.0666i 0.1081 + 0.0541i 0.1081 - 0.0541i 0.0000 + 1.7007i 0.0000 - 1.7007i

Iteration 6: a few Ritz values of the 20-by-20 matrix: 1.0e+03 *

0.0734 - 0.0095i -0.0072 + 0.1207i -0.0072 - 0.1207i 0.1081 - 0.0541i

10.5. A NUMERICAL EXAMPLE

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

185

2000

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1500

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1000

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

500

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

−500

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

−1000

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

−1500

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

−2000

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

−100

−50

0

 

 

50

100

150

−150

 

 

Figure 10.2: Spectrum of the matrix west0479

0.1081 + 0.0541i -0.1009 - 0.0666i -0.1009 + 0.0666i 0.0000 - 1.7007i 0.0000 + 1.7007i

Iteration 7: a few Ritz values of the 20-by-20 matrix: 1.0e+03 *

-0.0747

-0.0072 - 0.1207i -0.0072 + 0.1207i 0.1081 + 0.0541i 0.1081 - 0.0541i -0.1009 + 0.0666i -0.1009 - 0.0666i 0.0000 + 1.7007i 0.0000 - 1.7007i

The output indicates that eigs needs seven sweeps to compute the eigenvalues to the default accuracy of machepskAk. The Ritz values given are the approximations of the eigenvalues we want to compute. The complete spectrum of west0479 is given in Fig. 10.2. Notice the di erent scales of the axes! Fig. 10.3 is a zoom that shows all eigenvalues except the two very large ones. Here the axes are equally scaled. From the two figures it becomes clear that eigs has computed the eight eigenvalues (and corresponding eigenvectors) of largest modulus.

To compute the eigenvalues smallest in modulus we issue the following command.

dsm=eigs(west0479,8,’sm’);

Iteration 1: a few Ritz values of the 20-by-20 matrix:

0

186 CHAPTER 10. RESTARTING ARNOLDI AND LANCZOS ALGORITHMS

200

 

 

 

 

 

 

 

 

150

 

 

 

 

 

 

 

 

100

 

 

 

 

 

 

 

 

50

 

 

 

 

 

 

 

 

0

 

 

 

 

 

 

 

 

−50

 

 

 

 

 

 

 

 

−100

 

 

 

 

 

 

 

 

−150

 

 

 

 

 

 

 

 

−200

−150

−100

−50

0

50

100

150

200

−200

Figure 10.3: A zoom to the center of the spectrum of matrix west0479 that excludes the largest two eigenvalues on the imaginary axis

0

0

0

0

0

0

0

0

Iteration 2: a few Ritz values of the 20-by-20 matrix: 1.0e+03 *

-0.0228 - 0.0334i 0.0444

-0.0473

0.0116 + 0.0573i

0.0116 - 0.0573i -0.0136 - 0.1752i -0.0136 + 0.1752i -3.4455

5.8308

Iteration 3: a few Ritz values of the 20-by-20 matrix: 1.0e+03 *

10.5. A NUMERICAL EXAMPLE

187

-0.0228 - 0.0334i 0.0444

-0.0473

0.0116 + 0.0573i

0.0116 - 0.0573i -0.0136 + 0.1752i -0.0136 - 0.1752i -3.4455

5.8308

Iteration 4: a few Ritz values of the 20-by-20 matrix: 1.0e+03 *

-0.0228 + 0.0334i 0.0444

-0.0473

0.0116 - 0.0573i

0.0116 + 0.0573i -0.0136 + 0.1752i -0.0136 - 0.1752i -3.4455

5.8308

Iteration 5: a few Ritz values of the 20-by-20 matrix: 1.0e+03 *

-0.0228 + 0.0334i 0.0444

-0.0473

0.0116 - 0.0573i

0.0116 + 0.0573i -0.0136 + 0.1752i -0.0136 - 0.1752i -3.4455

5.8308

>> dsm

dsm =

0.0002 -0.0003

-0.0004 - 0.0057i -0.0004 + 0.0057i 0.0034 - 0.0168i 0.0034 + 0.0168i

-0.0211 0.0225

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]