Module 6.6: nag nsym gen eig Nonsymmetric Generalized Eigenvalue Problems. Contents

Similar documents
Module 5.2: nag sym lin sys Symmetric Systems of Linear Equations. Contents

Module 10.1: nag polynom eqn Roots of Polynomials. Contents

Module 10.2: nag nlin eqn Roots of a Single Nonlinear Equation. Contents

Module 3.9: nag kelvin fun Kelvin Functions. Contents

NAG Toolbox for Matlab nag_lapack_dggev (f08wa)

NAG Library Routine Document F08UBF (DSBGVX)

NAG Library Routine Document F08FPF (ZHEEVX)

NAG Library Routine Document F08FAF (DSYEV)

NAG Library Routine Document F07HAF (DPBSV)

NAG Library Routine Document F08PNF (ZGEES)

NAG Library Routine Document F08VAF (DGGSVD)

NAG Library Routine Document F08JDF (DSTEVR)

NAG Library Routine Document F08FNF (ZHEEV).1

NAG Fortran Library Routine Document F04CFF.1

Exponentials of Symmetric Matrices through Tridiagonal Reductions

NAG Toolbox for MATLAB Chapter Introduction. F02 Eigenvalues and Eigenvectors

NAG Library Routine Document F08YUF (ZTGSEN).1

NAG Library Routine Document F08QUF (ZTRSEN)

Solving large scale eigenvalue problems

Section 4.5 Eigenvalues of Symmetric Tridiagonal Matrices

NAG Library Routine Document F02HDF.1

Algorithm 853: an Efficient Algorithm for Solving Rank-Deficient Least Squares Problems

LAPACK-Style Codes for Pivoted Cholesky and QR Updating. Hammarling, Sven and Higham, Nicholas J. and Lucas, Craig. MIMS EPrint: 2006.

LAPACK-Style Codes for Pivoted Cholesky and QR Updating

Positive Denite Matrix. Ya Yan Lu 1. Department of Mathematics. City University of Hong Kong. Kowloon, Hong Kong. Abstract

Eigenvalue Problems and Singular Value Decomposition

NAG Library Routine Document F08QVF (ZTRSYL)

Using Godunov s Two-Sided Sturm Sequences to Accurately Compute Singular Vectors of Bidiagonal Matrices.

Eigenvalue and Eigenvector Problems

Module 11.4: nag quad util Numerical Integration Utilities. Contents

NAG Library Routine Document F08ZFF (DGGRQF).1

EIGENVALUE PROBLEMS (EVP)

Module 29.3: nag tsa spectral Time Series Spectral Analysis. Contents

Generalized interval arithmetic on compact matrix Lie groups

Computation of a canonical form for linear differential-algebraic equations

Arnoldi Methods in SLEPc

Package geigen. August 22, 2017

Eigenvalue problems. Eigenvalue problems

OUTLINE 1. Introduction 1.1 Notation 1.2 Special matrices 2. Gaussian Elimination 2.1 Vector and matrix norms 2.2 Finite precision arithmetic 2.3 Fact

A Note on Simple Nonzero Finite Generalized Singular Values

Numerical Methods for Solving Large Scale Eigenvalue Problems

A note on eigenvalue computation for a tridiagonal matrix with real eigenvalues Akiko Fukuda

D. Gimenez, M. T. Camara, P. Montilla. Aptdo Murcia. Spain. ABSTRACT

1. Introduction. Applying the QR algorithm to a real square matrix A yields a decomposition of the form

Solving large scale eigenvalue problems

Matrix Eigensystem Tutorial For Parallel Computation

APPLIED NUMERICAL LINEAR ALGEBRA

UMIACS-TR July CS-TR 2721 Revised March Perturbation Theory for. Rectangular Matrix Pencils. G. W. Stewart.

(Mathematical Operations with Arrays) Applied Linear Algebra in Geoscience Using MATLAB

F08BEF (SGEQPF/DGEQPF) NAG Fortran Library Routine Document

Index. for generalized eigenvalue problem, butterfly form, 211

Computing least squares condition numbers on hybrid multicore/gpu systems

F04JGF NAG Fortran Library Routine Document

NAG C Library Function Document nag_dtrevc (f08qkc)

Chapter f Linear Algebra

The QR Algorithm. Chapter The basic QR algorithm

Numerical Linear Algebra

Notes on Eigenvalues, Singular Values and QR

EIGIFP: A MATLAB Program for Solving Large Symmetric Generalized Eigenvalue Problems

Computing Eigenvalues and/or Eigenvectors;Part 2, The Power method and QR-algorithm

Foundations of Matrix Analysis

Beresford N. Parlett Λ. April 22, Early History of Eigenvalue Computations 1. 2 The LU and QR Algorithms 3. 3 The Symmetric Case 8

Accelerating computation of eigenvectors in the nonsymmetric eigenvalue problem

Direct methods for symmetric eigenvalue problems

1. Let m 1 and n 1 be two natural numbers such that m > n. Which of the following is/are true?

The QR Algorithm. Marco Latini. February 26, 2004

Synopsis of Numerical Linear Algebra

S.F. Xu (Department of Mathematics, Peking University, Beijing)

11.5 Reduction of a General Matrix to Hessenberg Form

NAG Library Routine Document C02AGF.1

Numerical Methods I Eigenvalue Problems

(Linear equations) Applied Linear Algebra in Geoscience Using MATLAB

Lecture 2: Numerical linear algebra

LAPACK Introduction. Zhaojun Bai University of California/Davis. James Demmel University of California/Berkeley

Accelerating computation of eigenvectors in the dense nonsymmetric eigenvalue problem

Computing Eigenvalues and/or Eigenvectors;Part 2, The Power method and QR-algorithm

11.0 Introduction. An N N matrix A is said to have an eigenvector x and corresponding eigenvalue λ if. A x = λx (11.0.1)

Testing Linear Algebra Software

On aggressive early deflation in parallel variants of the QR algorithm

Total 170. Name. Final Examination M340L-CS

Solution of eigenvalue problems. Subspace iteration, The symmetric Lanczos algorithm. Harmonic Ritz values, Jacobi-Davidson s method

Math 504 (Fall 2011) 1. (*) Consider the matrices

Matrix Algorithms. Volume II: Eigensystems. G. W. Stewart H1HJ1L. University of Maryland College Park, Maryland

Eigenvalues and eigenvectors

MATLAB TOOLS FOR SOLVING PERIODIC EIGENVALUE PROBLEMS 1

A Note on Eigenvalues of Perturbed Hermitian Matrices

A New Block Algorithm for Full-Rank Solution of the Sylvester-observer Equation.

EIGENVALUE PROBLEMS. EIGENVALUE PROBLEMS p. 1/4

Lecture notes on Quantum Computing. Chapter 1 Mathematical Background

Mathematical foundations - linear algebra

22.4. Numerical Determination of Eigenvalues and Eigenvectors. Introduction. Prerequisites. Learning Outcomes

MATH 423 Linear Algebra II Lecture 33: Diagonalization of normal operators.

ECS231 Handout Subspace projection methods for Solving Large-Scale Eigenvalue Problems. Part I: Review of basic theory of eigenvalue problems

Jim Lambers MAT 610 Summer Session Lecture 2 Notes

Unsupervised Data Discretization of Mixed Data Types

Second-order approximation of dynamic models without the use of tensors

A Method for Constructing Diagonally Dominant Preconditioners based on Jacobi Rotations

2 Computing complex square roots of a real matrix

AMS526: Numerical Analysis I (Numerical Linear Algebra)

Eigenvalue Problems. Eigenvalue problems occur in many areas of science and engineering, such as structural analysis

Transcription:

Eigenvalue and Least-squares Problems Module Contents Module 6.6: nag nsym gen eig Nonsymmetric Generalized Eigenvalue Problems nag nsym gen eig provides procedures for solving nonsymmetric generalized eigenvalue problems Ax = λbx, where A and B are general real or complex square matrices, and for computing the related generalized Schur factorization of the pencil A λb. Contents Introduction... 6.6.3 Procedures nag nsym gen eig all... 6.6.5 All eigenvalues, and optionally eigenvectors, of a real or complex nonsymmetric generalized eigenvalue problem nag gen schur fac... 6.6.9 Generalized Schur factorization of a real or complex matrix pencil Examples Example 1: Eigenvalues and eigenvectors of a real nonsymmetric generalized eigenvalue problem... 6.6.13 Example 2: Generalized Schur factorization of a real matrix pencil... 6.6.15 Additional Examples... 6.6.19 References... 6.6.20 [NP3245/3/pdf] Module 6.6: nag nsym gen eig 6.6.1

Module Contents Eigenvalue and Least-squares Problems 6.6.2 Module 6.6: nag nsym gen eig [NP3245/3/pdf]

Eigenvalue and Least-squares Problems Module Introduction Introduction 1 Notation and Background The generalized eigenvalue problem is to find the eigenvalues λ, and the corresponding eigenvectors x, satisfying Ax = λbx, x 0, (1) where A and B are real or complex square matrices. We also refer to the pencil A λb (that is the set of all matrices A λb where λ is a complex scalar), and to the eigenvalues of the pencil which are those values λ such that det(a λb) =0. If A and B are known to be real symmetric or complex Hermitian, and B positive definite, you should turn to the module nag sym gen eig (6.5) because in these cases the problem has special properties and it is desirable to take advantage of them (in particular, the eigenvalues are real). This module is intended for nonsymmetric generalized eigenvalue problems, whena and B are not known to satisfy the conditions for using nag sym gen eig. (Strictly speaking, when A and B are complex, we should talk of non-hermitian problems.) The eigenvalues and eigenvectors may be complex, even when A and B are real. If A and B are real, complex eigenvalues and eigenvectors always occur in complex conjugate pairs; if x is an eigenvector corresponding to the complex eigenvalue λ, then the complex conjugate vector x is the eigenvector corresponding to λ: Ax = λbx and A x = λb x. An eigenvector x defined in (1) is sometimes referred to as a right eigenvector. A left eigenvector y is defined by: y H A = λy H B or equivalently A H y = λb H y. Thus a left eigenvector of A λb is a right eigenvector of A H λb H (= A T λb T if A and B are real). Generalized eigenvalue problems exhibit a wider range of behaviour than standard eigenvalue problems (which result when B = I). 1. Infinite eigenvalues: the equation (1) may be re-written µax = Bx, where µ =1/λ. We say that λ is an infinite eigenvalue of the pencil A λb if and only if µ is a zero eigenvalue of the pencil B µa. Inthiscase,ifx is the corresponding right eigenvector, then Bx =0,soB must be singular and x is a null vector of B. 2. Singular pencils: if A and B are both singular and have a common null space, then for any vector x in this null space, Ax = λbx =0forall values of λ. The pencil A λb is called a singular pencil. See Wilkinson [4] for a discussion of the difficulties that can arise with pencils that are singular or almost singular. To cope with infinite eigenvalues and singular pencils, the procedures in this module do not compute the eigenvalues λ i directly, but return scalars α i and β i such that β i Ax i = α i Bx i, for i =1,...,n. For finite eigenvalues, λ i = α i /β i. Infinite eigenvalues are indicated by a zero value (or in practice a very small value) of β i. Singular pencils are generally indicated by zero values (or in practice very small values) of both α i and β i. [NP3245/3/pdf] Module 6.6: nag nsym gen eig 6.6.3

Module Introduction Eigenvalue and Least-squares Problems 2Generalized Schur Factorization An important tool for solving nonsymmetric generalized eigenvalue problems is the generalized Schur factorization of the pencil A λb (also referred to as the generalized Schur decomposition). This is defined as follows: if A and B are real, A = QT Z T and B = QSZ T, with T real upper quasi-triangular, S real upper triangular, and Q and Z orthogonal; if A and B are complex, A = QT Z H and B = QSZ H, with T and S complex upper triangular, and Q and Z unitary. The pencil T λs is called the generalized Schur form of A λb. The diagonal elements of S are the scalars β i referred to above. If A λb is complex, or if A λb is real and all its eigenvalues are real, then T is upper triangular, and the diagonal elements of T are the scalars α i.ifa λb is real and has complex conjugate pairs of eigenvalues, then, corresponding to each such pair, T has a 2 2blockon the diagonal; the eigenvalues of the diagonal blocks of T λs are the complex eigenvalues of A λb. The columns of Q are the left Schur vectors, and the columns of Z are the right Schur vectors. The Schur vectors are mutually orthogonal, unlike the eigenvectors, so they are often more satisfactory to work with in numerical computation. The eigenvalues of T λs are the same as the eigenvalues of A λb; ifx is a right eigenvector of T λs, then Zx is a right eigenvector of A λb; ify is a left eigenvector of T λs, thenqy is a left eigenvector of A λb. 3 Choice of Procedures Two procedures are provided in this module. They can be used for the following computations: All eigenvalues of A λb (nag nsym gen eig all) All eigenvalues and eigenvectorsof A λb (right, left or both) (nag nsym gen eig all with optional arguments) Generalized Schur form of A λb (nag gen schur fac) Generalized Schur form and vectors (right, left or both) of A λb (nag gen schur fac with optional arguments) 6.6.4 Module 6.6: nag nsym gen eig [NP3245/3/pdf]

Eigenvalue and Least-squares Problems nag nsym gen eig all Procedure: nag nsym gen eig all 1 Description nag nsym gen eig all is a generic procedure which computes all the eigenvalues, and optionally all the left or right eigenvectors, of a real or complex generalized eigenvalue problem. Let A and B be real or complex square matrices of order n. Wewrite: β i Ax i = α i Bx i,fori =1,...,n, for the right eigenvectors x i ; β i y H i A = α iy H i B,fori =1,...,n, for the left eigenvectors y i. In exact arithmetic: β i 0 indicates a finite eigenvalue λ i = α i /β i ; β i =0andα i 0 indicates an infinite eigenvalue; α i = β i = 0 indicates that the pencil is singular. In finite-precision arithmetic, particular care must be taken if α i and β i are both small (compared with A and B ): this indicates that the pencil is almost singular, and it may be that no reliance can be placed on the values of any of the other eigenvalues λ j = α j /β j (see Wilkinson [4]). The values α i and the eigenvectors x i or y i may be complex, even when A and B are real. They are always returned in complex arrays. By default, only values α i and β i are computed. Optionally, either the right or left eigenvectors, or both, may be computed. Each (left or right) eigenvector x is normalized so that x 2 = 1 and the element of largest absolute value is real and positive. 2Usage USE nag nsym gen eig CALL nag nsym gen eig all(a, b, alpha, beta [, optional arguments]) 3 Arguments Note. All array arguments are assumed-shape arrays. The extent in each dimension must be exactly that required by the problem. Notation such as x(n) is used in the argument descriptions to specify that the array x must have exactly n elements. This procedure derives the value of the following problem parameter from the shape of the supplied arrays. n the order of the matrices A and B 3.1 Mandatory Arguments a(n, n) real(kind=wp) / complex(kind=wp), intent(inout) Input: the general matrix A. Output: overwritten by intermediate results. [NP3245/3/pdf] Module 6.6: nag nsym gen eig 6.6.5

nag nsym gen eig all Eigenvalue and Least-squares Problems b(n, n) real(kind=wp) / complex(kind=wp), intent(inout) Input: the general matrix B. Output: overwritten by intermediate results. Constraints: b must be of the same type as a. alpha(n) complex(kind=wp), intent(out) Output: the values α i. beta(n) real(kind=wp), intent(out) Output: the values β i. 3.2 Optional Arguments Note. Optional arguments must be supplied by keyword, not by position. The order in which they are described below may differ from the order in which they occur in the argument list. vr(n, n) complex(kind=wp), intent(out), optional Output: the right eigenvectors. The ith column vr(:,i) holds the right eigenvector corresponding to the eigenvalue λ i (= α i /β i ). Constraints: vr must be of the same type as a. vl(n, n) complex(kind=wp), intent(out), optional Output: the left eigenvectors. The ith column vl(:,i) holds the left eigenvector corresponding to the eigenvalue λ i (= α i /β i ). Constraints: vl must be of the same type as a. error type(nagerror), intent(inout), optional The NAG fl 90 error-handling argument. See the Essential Introduction, or the module document nag error handling (1.2). You are recommended to omit this argument if you are unsure how to use it. If this argument is supplied, it must be initialized by a call to nag set error before this procedure is called. 4 Error Codes Fatal errors (error%level = 3): error%code Description 302 An array argument has an invalid shape. 303 Array arguments have inconsistent shapes. 320 The procedure was unable to allocate enough memory. Failures (error%level = 2): error%code Description 201 Failure to converge. The QZ algorithm failed to compute all the eigenvalues in the permitted number of iterations. 6.6.6 Module 6.6: nag nsym gen eig [NP3245/3/pdf]

Eigenvalue and Least-squares Problems nag nsym gen eig all 5 Examples of Usage A complete example of the use of this procedure appears in Example 1 of this module document. In that example, the following call statement is used to compute eigenvalues and right eigenvectors: CALL nag_gen_nsym_eig_all( a, b, alpha, beta, vr=vr ) To compute eigenvalues only, the call statement should be changed to: CALL nag_gen_nsym_eig_all( a, b, alpha, beta ) To compute left eigenvectors as well as right eigenvectors, a suitable array vl must be declared, and the call statement changed to: CALL nag_nsym_eig_all( a, b, alpha, beta, vr=vr, vl=vl ) 6 Further Comments 6.1 Algorithmic Detail The procedure performs the following steps (see Chapter 7 of Golub and Van Loan [2] for more details). 1. It balances the pencil, using diagonal transformations to try to make the norms of the rows and columns of A and B as close to 1 as possible. 2. It reduces the balanced pencil à λ B by an orthogonal or unitary transformation to a pencil H λk, whereh is upper Hessenberg and K is upper triangular: à = Q 1 HZ H 1 and B = Q 1 KZ H 1. H λk has the same eigenvalues as A λb. If left eigenvectors are required, it forms the matrix Q 1 ; if right eigenvectors are required, it forms the matrix Z 1. 3. If only eigenvalues are required, it applies the QZ algorithm to compute the values α i and β i. 4. If eigenvectors are required, it applies the QZ algorithm to reduce the upper Hessenberg matrix H to quasi-triangular form while maintaining K in upper triangular form. This gives the generalized Schur factorization of H λk: H = Q 2 TZ2 H and K = Q 2 SZ2 H. If left eigenvectors are required, the matrix Q = Q 1 Q 2 is formed; if right eigenvectors are required, the matrix Z = Z 1 Z 2 is formed. 5. It then computes the required eigenvectors of the pencil T λs by backward substitution; it premultiplies left eigenvectors by Q and right eigenvectors by Z to give eigenvectors of the balanced pencil à λ B. Finally it transforms them to eigenvectors of the original pencil A λb. The algorithms are derived from LAPACK (see Anderson et al. [1]). 6.2 Accuracy The computed eigenvalues are always exact for a perturbed problem (A + δa)x = λ(b + δb)x, where δa / A and δb / B are of the order of the machine precision, EPSILON(1.0 wp). For a discussion of the sensitivity of the problem to perturbations in the data, see Stewart and Sun [3]. 6.3 Timing The time taken by the procedure is approximately proportional to n 3. Computing both eigenvalues and eigenvectors is likely to take about twice as long as computing eigenvalues alone. [NP3245/3/pdf] Module 6.6: nag nsym gen eig 6.6.7

nag nsym gen eig all Eigenvalue and Least-squares Problems 6.6.8 Module 6.6: nag nsym gen eig [NP3245/3/pdf]

Eigenvalue and Least-squares Problems nag gen schur fac Procedure: nag gen schur fac 1 Description nag gen schur fac is a generic procedure which computes part or all of the generalized Schur factorization of a matrix pencil A λb, wherea and B are real or complex square matrices of order n. We write the generalized Schur factorization as follows: if A and B are real, A = QT Z T and B = QSZ T, with T real upper quasi-triangular, S real upper triangular, and Q and Z orthogonal; if A and B are complex, A = QT Z H and B = QSZ H, with T and S complex upper triangular, and Q and Z unitary. See the Module Introduction for more details. By default, only the matrices T and S of the generalized Schur form are computed. Optionally, the matrix Q of left Schur vectors, or the matrix Z of right Schur vectors, or both, may be computed; and the values α i and β i may be extracted from T and S and stored in separate arrays. If only the eigenvalues are required, it is more efficient to call nag nsym gen eig all. 2Usage USE nag nsym gen eig CALL nag gen schur fac(a, b [, optional arguments]) 3 Arguments Note. All array arguments are assumed-shape arrays. The extent in each dimension must be exactly that required by the problem. Notation such as x(n) is used in the argument descriptions to specify that the array x must have exactly n elements. This procedure derives the value of the following problem parameter from the shape of the supplied arrays. n the order of the matrices A and B 3.1 Mandatory Arguments a(n, n) real(kind=wp) / complex(kind=wp), intent(inout) Input: the general matrix A. Output: the matrix T of the generalized Schur form. b(n, n) real(kind=wp) / complex(kind=wp), intent(inout) Input: the general matrix B. Output: the matrix S of the generalized Schur form. Constraints: b must be of the same type as a. [NP3245/3/pdf] Module 6.6: nag nsym gen eig 6.6.9

nag gen schur fac Eigenvalue and Least-squares Problems 3.2 Optional Arguments Note. Optional arguments must be supplied by keyword, not by position. The order in which they are described below may differ from the order in which they occur in the argument list. alpha(n) complex(kind=wp), intent(out), optional Output: the values α i. beta(n) real(kind=wp), intent(out), optional Output: the values β i. Constraints: alpha and beta must both be present or both absent. q(n, n) real(kind=wp) / complex(kind=wp), intent(out), optional Output: the matrix Q of left Schur vectors. Constraints: q must be of the same type as a. z(n, n) real(kind=wp) / complex(kind=wp), intent(out), optional Output: the matrix Z of right Schur vectors. Constraints: z must be of the same type as a. error type(nagerror), intent(inout), optional The NAG fl 90 error-handling argument. See the Essential Introduction, or the module document nag error handling (1.2). You are recommended to omit this argument if you are unsure how to use it. If this argument is supplied, it must be initialized by a call to nag set error before this procedure is called. 4 Error Codes Fatal errors (error%level = 3): error%code Description 302 An array argument has an invalid shape. 303 Array arguments have inconsistent shapes. 305 Invalid absence of an optional argument. 320 The procedure was unable to allocate enough memory. Failures (error%level = 2): error%code Description 201 Failure to converge. The QZ algorithm failed to compute all the eigenvalues in the permitted number of iterations. 5 Examples of Usage A complete example of the use of this procedure appears in Example 2 of this module document. 6.6.10 Module 6.6: nag nsym gen eig [NP3245/3/pdf]

Eigenvalue and Least-squares Problems nag gen schur fac 6 Further Comments 6.1 Algorithmic Detail The procedure performs the following steps (see Chapter 7 of Golub and Van Loan [2] for more details). 1. It reduces the pencil A λb by an orthogonal or unitary transformation to a pencil H λk, where H is upper Hessenberg and K is upper triangular: A = Q 1 HZ1 H and B = Q 1 KZ1 H.Ifleft Schur vectors are required, it forms the matrix Q 1 ; if right Schur vectors are required, it forms the matrix Z 1. 2. It applies the QZ algorithm to reduce the upper Hessenberg matrix H to quasi-triangular form while maintaining K in upper triangular form. This gives the generalized Schur factorization of H λk: H = Q 2 TZ H 2 and K = Q 2SZ H 2. If left Schur vectors are required, the matrix Q = Q 1Q 2 is formed; if right Schur vectors are required, the matrix Z = Z 1 Z 2 is formed. The algorithms are derived from LAPACK (see Anderson et al. [1]). 6.2 Accuracy The computed decomposition is the exact decomposition of a perturbed pencil (A + δa) λ(b + δb), where δa / A and δb / B are of the order of the machine precision, EPSILON(1.0 wp). For a discussion of the sensitivity of the problem to perturbations in the data, see Stewart and Sun [3]. 6.3 Timing The time taken by the procedure is approximately proportional to n 3. Computing both eigenvalues and Schur vectors is likely to take about twice as long as computing eigenvalues alone. [NP3245/3/pdf] Module 6.6: nag nsym gen eig 6.6.11

nag gen schur fac Eigenvalue and Least-squares Problems 6.6.12 Module 6.6: nag nsym gen eig [NP3245/3/pdf]

Eigenvalue and Least-squares Problems Example 1 Example 1: Eigenvalues and eigenvectors of a real nonsymmetric generalized eigenvalue problem Compute all the eigenvalues and the right eigenvectors of a real nonsymmetric generalized eigenvalue problem Az = λbz. 1 Program Text Note. The listing of the example program presented below is double precision. Single precision users are referred to Section 5.2 of the Essential Introduction for further information. PROGRAM nag_nsym_gen_eig_ex01! Example Program Text for nag_nsym_gen_eig! NAG fl90, Release 3. NAG Copyright 1997.!.. Use Statements.. USE nag_examples_io, ONLY : nag_std_in, nag_std_out USE nag_nsym_gen_eig, ONLY : nag_nsym_gen_eig_all USE nag_write_mat, ONLY : nag_write_gen_mat!.. Implicit None Statement.. IMPLICIT NONE!.. Intrinsic Functions.. INTRINSIC KIND!.. Parameters.. INTEGER, PARAMETER :: wp = KIND(1.0D0)!.. Local Scalars.. INTEGER :: i, n!.. Local Arrays.. REAL (wp), ALLOCATABLE :: a(:,:), b(:,:), beta(:) COMPLEX (wp), ALLOCATABLE :: alpha(:), vr(:,:)!.. Executable Statements.. WRITE (nag_std_out,*) & Example Program Results for nag_nsym_gen_eig_ex01 READ (nag_std_in,*) READ (nag_std_in,*) n! Skip heading in data file ALLOCATE (a(n,n),b(n,n),alpha(n),beta(n),vr(n,n))! Allocate storage READ (nag_std_in,*) (a(i,:),i=1,n) READ (nag_std_in,*) (b(i,:),i=1,n)! Compute the right eigenvectors CALL nag_nsym_gen_eig_all(a,b,alpha,beta,vr=vr) WRITE (nag_std_out,*) WRITE (nag_std_out,*) Eigenvalues WRITE (nag_std_out, (1X,"(",F7.4,",",F7.4,")") ) alpha/beta WRITE (nag_std_out,*) CALL nag_write_gen_mat(vr,int_col_labels=.true.,format= (F7.4), & title= Matrix ofright eigenvectors (one vector per column) ) DEALLOCATE (a,b,alpha,beta,vr)! Deallocate storage END PROGRAM nag_nsym_gen_eig_ex01 [NP3245/3/pdf] Module 6.6: nag nsym gen eig 6.6.13

Example 1 Eigenvalue and Least-squares Problems 2Program Data Example Program Data for nag_nsym_gen_eig_ex01 4 :Value ofn 3.9 12.5-34.5-0.5 4.3 21.5-47.5 7.5 4.3 21.5-43.5 3.5 4.4 26.0-46.0 6.0 :End ofmatrix A 1.0 2.0-3.0 1.0 1.0 3.0-5.0 4.0 1.0 3.0-4.0 3.0 1.0 3.0-4.0 4.0 :End ofmatrix B 3 Program Results Example Program Results for nag_nsym_gen_eig_ex01 Eigenvalues ( 2.0000, 0.0000) ( 3.0000, 4.0000) ( 3.0000,-4.0000) ( 4.0000, 0.0000) Matrix ofright eigenvectors (one vector per column) 1 2 3 4 ( 0.9961, 0.0000) ( 0.9449, 0.0000) ( 0.9449, 0.0000) ( 0.9875, 0.0000) ( 0.0057, 0.0000) ( 0.1890, 0.0000) ( 0.1890, 0.0000) ( 0.0110, 0.0000) ( 0.0626, 0.0000) ( 0.1134,-0.1512) ( 0.1134, 0.1512) (-0.0329, 0.0000) ( 0.0626, 0.0000) ( 0.1134,-0.1512) ( 0.1134, 0.1512) ( 0.1536, 0.0000) 6.6.14 Module 6.6: nag nsym gen eig [NP3245/3/pdf]

Eigenvalue and Least-squares Problems Example 2 Example 2: Generalized Schur factorization of a real matrix pencil Compute the generalized Schur factorization of a real matrix pencil A λb. 1 Program Text Note. The listing of the example program presented below is double precision. Single precision users are referred to Section 5.2 of the Essential Introduction for further information. PROGRAM nag_nsym_gen_eig_ex02! Example Program Text for nag_nsym_gen_eig! NAG fl90, Release 3. NAG Copyright 1997.!.. Use Statements.. USE nag_examples_io, ONLY : nag_std_in, nag_std_out USE nag_nsym_gen_eig, ONLY : nag_gen_schur_fac USE nag_write_mat, ONLY : nag_write_gen_mat!.. Implicit None Statement.. IMPLICIT NONE!.. Intrinsic Functions.. INTRINSIC KIND!.. Parameters.. INTEGER, PARAMETER :: wp = KIND(1.0D0)!.. Local Scalars.. INTEGER :: i, n!.. Local Arrays.. REAL (wp), ALLOCATABLE :: a(:,:), b(:,:), beta(:), q(:,:), z(:,:) COMPLEX (wp), ALLOCATABLE :: alpha(:)!.. Executable Statements.. WRITE (nag_std_out,*) & Example Program Results for nag_nsym_gen_eig_ex02 READ (nag_std_in,*) READ (nag_std_in,*) n! Skip heading in data file ALLOCATE (a(n,n),b(n,n),alpha(n),beta(n),q(n,n), & z(n,n))! Allocate storage READ (nag_std_in,*) (a(i,:),i=1,n) READ (nag_std_in,*) (b(i,:),i=1,n)! Compute the generalized Schur factorization CALL nag_gen_schur_fac(a,b,alpha=alpha,beta=beta,q=q,z=z) WRITE (nag_std_out,*) WRITE (nag_std_out,*) Eigenvalues WRITE (nag_std_out, (1X,"(",F7.4,",",F7.4,")") ) alpha/beta WRITE (nag_std_out,*) CALL nag_write_gen_mat(a,int_col_labels=.true.,format= (F11.4), & title= generalized Schur form of A ) WRITE (nag_std_out,*) CALL nag_write_gen_mat(b,int_col_labels=.true.,format= (F11.4), & title= generalized Schur form of B ) WRITE (nag_std_out,*) [NP3245/3/pdf] Module 6.6: nag nsym gen eig 6.6.15

Example 2 Eigenvalue and Least-squares Problems CALL nag_write_gen_mat(q,int_col_labels=.true.,format= (F11.4), & title= Matrix ofleft Schur vectors (one vector per column) ) WRITE (nag_std_out,*) CALL nag_write_gen_mat(z,int_col_labels=.true.,format= (F11.4), & title= Matrix ofright Schur vectors (one vector per column) ) DEALLOCATE (a,b,alpha,beta,q,z)! Deallocate storage END PROGRAM nag_nsym_gen_eig_ex02 2Program Data Example Program Data for nag_nsym_gen_eig_ex02 4 :Value ofn 3.9 12.5-34.5-0.5 4.3 21.5-47.5 7.5 4.3 21.5-43.5 3.5 4.4 26.0-46.0 6.0 :End ofmatrix A 1.0 2.0-3.0 1.0 1.0 3.0-5.0 4.0 1.0 3.0-4.0 3.0 1.0 3.0-4.0 4.0 :End ofmatrix B 3 Program Results Example Program Results for nag_nsym_gen_eig_ex02 Eigenvalues ( 2.0000, 0.0000) ( 3.0000, 4.0000) ( 3.0000,-4.0000) ( 4.0000, 0.0000) generalized Schur form of A 1 2 3 4 3.8009-31.3260 61.4846-66.8359 0.0000 3.3505 7.0744-6.6922 0.0000-1.1918 1.4098-4.3790 0.0000 0.0000 0.0000 4.0000 generalized Schur form of B 1 2 3 4 1.9005 1.0777 5.6252-9.9873 0.0000 1.1761 0.0000-1.7511 0.0000 0.0000 0.4474-1.0901 0.0000 0.0000 0.0000 1.0000 Matrix ofleft Schur vectors (one vector per column) 1 2 3 4 0.4642-0.8116-0.3547 0.0000 0.5002 0.0697 0.4950-0.7071 0.5002 0.0697 0.4950 0.7071 0.5331 0.5758-0.6198 0.0000 Matrix ofright Schur vectors (one vector per column) 1 2 3 4 0.9961-0.0818 0.0343 0.0000 0.0057 0.4445 0.8957 0.0000 6.6.16 Module 6.6: nag nsym gen eig [NP3245/3/pdf]

Eigenvalue and Least-squares Problems Example 2 0.0626 0.6307-0.3134 0.7071 0.0626 0.6307-0.3134-0.7071 [NP3245/3/pdf] Module 6.6: nag nsym gen eig 6.6.17

Example 2 Eigenvalue and Least-squares Problems 6.6.18 Module 6.6: nag nsym gen eig [NP3245/3/pdf]

Eigenvalue and Least-squares Problems Additional Examples Additional Examples Not all example programs supplied with NAG fl 90 appear in full in this module document. The following additional examples, associated with this module, are available. nag nsym gen eig ex03 Computes the generalized Schur factorization of a complex matrix pencil. nag nsym gen eig ex04 Computes all the eigenvalues and both the right and the left eigenvectors of a complex nonsymmetric generalized eigenvalue problem Az = λbz. [NP3245/3/pdf] Module 6.6: nag nsym gen eig 6.6.19

References Eigenvalue and Least-squares Problems References [1] Anderson E, Bai Z, Bischof C, Demmel J, Dongarra J J, Du Croz J J, Greenbaum A, Hammarling S, McKenney A, Ostrouchov S and Sorensen D (1995) LAPACK Users Guide (2nd Edition) SIAM, Philadelphia [2] Golub G H and Van Loan C F (1989) Matrix Computations Johns Hopkins University Press (2nd Edition) [3] Stewart G W and Sun J-G (1990) Matrix Perturbation Theory Academic Press [4] Wilkinson J H (1979) Kronecker s canonical form and the QZ algorithm Linear Algebra Appl. 28 285 303 6.6.20 Module 6.6: nag nsym gen eig [NP3245/3/pdf]