hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_lapack_dgghrd (f08we)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_lapack_dgghrd (f08we) reduces a pair of real matrices A,B, where B is upper triangular, to the generalized upper Hessenberg form using orthogonal transformations.

Syntax

[a, b, q, z, info] = f08we(compq, compz, ilo, ihi, a, b, q, z, 'n', n)
[a, b, q, z, info] = nag_lapack_dgghrd(compq, compz, ilo, ihi, a, b, q, z, 'n', n)

Description

nag_lapack_dgghrd (f08we) is the third step in the solution of the real generalized eigenvalue problem
Ax=λBx.  
The (optional) first step balances the two matrices using nag_lapack_dggbal (f08wh). In the second step, matrix B is reduced to upper triangular form using the QR factorization function nag_lapack_dgeqrf (f08ae) and this orthogonal transformation Q is applied to matrix A by calling nag_lapack_dormqr (f08ag).
nag_lapack_dgghrd (f08we) reduces a pair of real matrices A,B, where B is upper triangular, to the generalized upper Hessenberg form using orthogonal transformations. This two-sided transformation is of the form
QTAZ=H QTBZ=T  
where H is an upper Hessenberg matrix, T is an upper triangular matrix and Q and Z are orthogonal matrices determined as products of Givens rotations. They may either be formed explicitly, or they may be postmultiplied into input matrices Q1 and Z1, so that
Q1AZ1T=Q1QHZ1ZT, Q1BZ1T=Q1QTZ1ZT.  

References

Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore
Moler C B and Stewart G W (1973) An algorithm for generalized matrix eigenproblems SIAM J. Numer. Anal. 10 241–256

Parameters

Compulsory Input Parameters

1:     compq – string (length ≥ 1)
Specifies the form of the computed orthogonal matrix Q.
compq='N'
Do not compute Q.
compq='I'
The orthogonal matrix Q is returned.
compq='V'
q must contain an orthogonal matrix Q1, and the product Q1Q is returned.
Constraint: compq='N', 'I' or 'V'.
2:     compz – string (length ≥ 1)
Specifies the form of the computed orthogonal matrix Z.
compz='N'
Do not compute Z.
compz='I'
The orthogonal matrix Z is returned.
compz='V'
z must contain an orthogonal matrix Z1, and the product Z1Z is returned.
Constraint: compz='N', 'V' or 'I'.
3:     ilo int64int32nag_int scalar
4:     ihi int64int32nag_int scalar
ilo and ihi as determined by a previous call to nag_lapack_dggbal (f08wh). Otherwise, they should be set to 1 and n, respectively.
Constraints:
  • if n>0, 1 ilo ihi n ;
  • if n=0, ilo=1 and ihi=0.
5:     alda: – double array
The first dimension of the array a must be at least max1,n.
The second dimension of the array a must be at least max1,n.
The matrix A of the matrix pair A,B. Usually, this is the matrix A returned by nag_lapack_dormqr (f08ag).
6:     bldb: – double array
The first dimension of the array b must be at least max1,n.
The second dimension of the array b must be at least max1,n.
The upper triangular matrix B of the matrix pair A,B. Usually, this is the matrix B returned by the QR factorization function nag_lapack_dgeqrf (f08ae).
7:     qldq: – double array
The first dimension, ldq, of the array q must satisfy
  • if compq='I' or 'V', ldq max1,n ;
  • if compq='N', ldq1.
The second dimension of the array q must be at least max1,n if compq='I' or 'V' and at least 1 if compq='N'.
If compq='V', q must contain an orthogonal matrix Q1.
If compq='N', q is not referenced.
8:     zldz: – double array
The first dimension, ldz, of the array z must satisfy
  • if compz='V' or 'I', ldz max1,n ;
  • if compz='N', ldz1.
The second dimension of the array z must be at least max1,n if compz='V' or 'I' and at least 1 if compz='N'.
If compz='V', z must contain an orthogonal matrix Z1.
If compz='N', z is not referenced.

Optional Input Parameters

1:     n int64int32nag_int scalar
Default: the first dimension of the array z.
n, the order of the matrices A and B.
Constraint: n0.

Output Parameters

1:     alda: – double array
The first dimension of the array a will be max1,n.
The second dimension of the array a will be max1,n.
a stores the upper Hessenberg matrix H.
2:     bldb: – double array
The first dimension of the array b will be max1,n.
The second dimension of the array b will be max1,n.
b stores the upper triangular matrix T.
3:     qldq: – double array
The first dimension, ldq, of the array q will be
  • if compq='I' or 'V', ldq= max1,n ;
  • if compq='N', ldq=1.
The second dimension of the array q will be max1,n if compq='I' or 'V' and at least 1 if compq='N'.
If compq='I', q contains the orthogonal matrix Q.
If compq='V', q stores Q1Q.
4:     zldz: – double array
The first dimension, ldz, of the array z will be
  • if compz='V' or 'I', ldz= max1,n ;
  • if compz='N', ldz=1.
The second dimension of the array z will be max1,n if compz='V' or 'I' and at least 1 if compz='N'.
If compz='I', z contains the orthogonal matrix Z.
If compz='V', z stores Z1Z.
5:     info int64int32nag_int scalar
info=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

   info=-i
If info=-i, parameter i had an illegal value on entry. The parameters are numbered as follows:
1: compq, 2: compz, 3: n, 4: ilo, 5: ihi, 6: a, 7: lda, 8: b, 9: ldb, 10: q, 11: ldq, 12: z, 13: ldz, 14: info.
It is possible that info refers to a parameter that is omitted from the MATLAB interface. This usually indicates that an error in one of the other input parameters has caused an incorrect value to be inferred.

Accuracy

The reduction to the generalized Hessenberg form is implemented using orthogonal transformations which are backward stable.

Further Comments

This function is usually followed by nag_lapack_dhgeqz (f08xe) which implements the QZ algorithm for computing generalized eigenvalues of a reduced pair of matrices.
The complex analogue of this function is nag_lapack_zgghrd (f08ws).

Example

See Example in nag_lapack_dhgeqz (f08xe) and nag_lapack_dtgevc (f08yk).
function f08we_example


fprintf('f08we example results\n\n');

a = [ 1.0   1.0    1.0    1.0     1.0;
      2.0   4.0    8.0   16.0    32.0;
      3.0   9.0   27.0   81.0   243.0;
      4.0  16.0   64.0  256.0  1024.0;
      5.0  25.0  125.0  625.0  3125.0];
b = a';

%' Balance A and B
job = 'B';
[a, b, ilo, ihi, lscale, rscale, info] = ...
  f08wh( ...
	 job, a, b);

bbal = b(ilo:ihi,ilo:ihi);
abal = a(ilo:ihi,ilo:ihi);

% QR factorize balanced B
[QR, tau, info] = f08ae(bbal);

% Perform C = Q^T*A
side = 'Left';
trans = 'Transpose';
[c, info] = f08ag( ...
		   side, trans, QR, tau, abal);

% Generalized Hessenberg form (C,R) -> (H,T)
compq = 'No Q';
compz = 'No Z';
z = eye(4);
q = eye(4);
jlo = int64(1);
jhi = int64(ihi-ilo+1);
[H, T, ~, ~, info] = ...
  f08we( ...
	 compq, compz, jlo, jhi, c, QR, q, z);

% Find eigenvalues of generalized Hessenberg form
%    = eigenvalues of (A,B).
job = 'Eigenvalues';
[~, ~, alphar, alphai, beta, ~, ~, info] = ...
  f08xe( ...
	 job, compq, compz, jlo, jhi, H, T, q, z);

disp('Generalized eigenvalues of (A,B):');
w = complex(alphar+i*alphai);
disp(w./beta);


f08we example results

Generalized eigenvalues of (A,B):
  -2.4367 + 0.0000i
   0.6069 + 0.7948i
   0.6069 - 0.7948i
   1.0000 + 0.0000i
  -0.4104 + 0.0000i


PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

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