F08WHF (DGGBAL) (PDF version)
F08 Chapter Contents
F08 Chapter Introduction
NAG Library Manual

NAG Library Routine Document

F08WHF (DGGBAL)

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

+ Contents

    1  Purpose
    7  Accuracy
    9  Example

1  Purpose

F08WHF (DGGBAL) balances a pair of real square matrices A,B of order n. Balancing usually improves the accuracy of computed generalized eigenvalues and eigenvectors.

2  Specification

SUBROUTINE F08WHF ( JOB, N, A, LDA, B, LDB, ILO, IHI, LSCALE, RSCALE, WORK, INFO)
INTEGER  N, LDA, LDB, ILO, IHI, INFO
REAL (KIND=nag_wp)  A(LDA,*), B(LDB,*), LSCALE(N), RSCALE(N), WORK(*)
CHARACTER(1)  JOB
The routine may be called by its LAPACK name dggbal.

3  Description

Balancing may reduce the 1-norms of the matrices and improve the accuracy of the computed eigenvalues and eigenvectors in the real generalized eigenvalue problem
Ax=λBx.
F08WHF (DGGBAL) is usually the first step in the solution of the above generalized eigenvalue problem. Balancing is optional but it is highly recommended.
The term ‘balancing’ covers two steps, each of which involves similarity transformations on A and B. The routine can perform either or both of these steps. Both steps are optional.
  1. The routine first attempts to permute A and B to block upper triangular form by a similarity transformation:
    PAPT=F= F11 F12 F13 F22 F23 F33
    PBPT=G= G11 G12 G13 G22 G23 G33
    where P is a permutation matrix, F11, F33, G11 and G33 are upper triangular. Then the diagonal elements of the matrix pairs F11,G11 and F33,G33 are generalized eigenvalues of A,B. The rest of the generalized eigenvalues are given by the matrix pair F22,G22 which are in rows and columns ilo to ihi. Subsequent operations to compute the generalized eigenvalues of A,B need only be applied to the matrix pair F22,G22; this can save a significant amount of work if ilo>1 and ihi<n. If no suitable permutation exists (as is often the case), the routine sets ilo=1 and ihi=n.
  2. The routine applies a diagonal similarity transformation to F,G, to make the rows and columns of F22,G22 as close in norm as possible:
    DFD^= I 0 0 0 D22 0 0 0 I F11 F12 F13 F22 F23 F33 I 0 0 0 D^22 0 0 0 I
    DGD^= I 0 0 0 D22 0 0 0 I G11 G12 G13 G22 G23 G33 I 0 0 0 D^22 0 0 0 I
    This transformation usually improves the accuracy of computed generalized eigenvalues and eigenvectors.

4  References

Ward R C (1981) Balancing the generalized eigenvalue problem SIAM J. Sci. Stat. Comp. 2 141–152

5  Parameters

1:     JOB – CHARACTER(1)Input
On entry: specifies the operations to be performed on matrices A and B.
JOB='N'
No balancing is done. Initialize ILO=1, IHI=N, LSCALEi=1.0 and RSCALEi=1.0, for i=1,2,,n.
JOB='P'
Only permutations are used in balancing.
JOB='S'
Only scalings are are used in balancing.
JOB='B'
Both permutations and scalings are used in balancing.
Constraint: JOB='N', 'P', 'S' or 'B'.
2:     N – INTEGERInput
On entry: n, the order of the matrices A and B.
Constraint: N0.
3:     A(LDA,*) – REAL (KIND=nag_wp) arrayInput/Output
Note: the second dimension of the array A must be at least max1,N.
On entry: the n by n matrix A.
On exit: A is overwritten by the balanced matrix. If JOB='N', A is not referenced.
4:     LDA – INTEGERInput
On entry: the first dimension of the array A as declared in the (sub)program from which F08WHF (DGGBAL) is called.
Constraint: LDAmax1,N.
5:     B(LDB,*) – REAL (KIND=nag_wp) arrayInput/Output
Note: the second dimension of the array B must be at least max1,N.
On entry: the n by n matrix B.
On exit: B is overwritten by the balanced matrix. If JOB='N', B is not referenced.
6:     LDB – INTEGERInput
On entry: the first dimension of the array B as declared in the (sub)program from which F08WHF (DGGBAL) is called.
Constraint: LDBmax1,N.
7:     ILO – INTEGEROutput
8:     IHI – INTEGEROutput
On exit: ilo and ihi are set such that Aij=0 and Bij=0 if i>j and 1j<ilo or ihi<in.
If JOB='N' or 'S', ilo=1 and ihi=n.
9:     LSCALE(N) – REAL (KIND=nag_wp) arrayOutput
On exit: details of the permutations and scaling factors applied to the left side of the matrices A and B. If Pi is the index of the row interchanged with row i and di is the scaling factor applied to row i, then
  • LSCALEi=Pi, for i=1,2,,ilo-1;
  • LSCALEi=di, for i=ilo,,ihi;
  • LSCALEi=Pi, for i=ihi+1,,n.
The order in which the interchanges are made is n to ihi+1, then 1 to ilo-1.
10:   RSCALE(N) – REAL (KIND=nag_wp) arrayOutput
On exit: details of the permutations and scaling factors applied to the right side of the matrices A and B.
If Pj is the index of the column interchanged with column j and d^j is the scaling factor applied to column j, then
  • RSCALEj=Pj, for j=1,2,,ilo-1;
  • RSCALEj=d^j, for j=ilo,,ihi;
  • RSCALEj=Pj, for j=ihi+1,,n.
The order in which the interchanges are made is n to ihi+1, then 1 to ilo-1.
11:   WORK(*) – REAL (KIND=nag_wp) arrayWorkspace
Note: the dimension of the array WORK must be at least max1,6×N if JOB='S' or 'B' and at least 1 if JOB='N' or 'P'.
12:   INFO – INTEGEROutput
On exit: INFO=0 unless the routine detects an error (see Section 6).

6  Error Indicators and Warnings

Errors or warnings detected by the routine:
INFO<0
If INFO=-i, argument i had an illegal value. An explanatory message is output, and execution of the program is terminated.

7  Accuracy

The errors are negligible, compared to those in subsequent computations.

8  Further Comments

F08WHF (DGGBAL) is usually the first step in computing the real generalized eigenvalue problem but it is an optional step. The matrix B is reduced to the upper triangular form using the QR factorization routine F08AEF (DGEQRF) and this orthogonal transformation Q is applied to the matrix A by calling F08AGF (DORMQR). This is followed by F08WEF (DGGHRD) which reduces the matrix pair into the generalized Hessenberg form.
If the matrix pair A,B is balanced by this routine, then any generalized eigenvectors computed subsequently are eigenvectors of the balanced matrix pair. In that case, to compute the generalized eigenvectors of the original matrix, F08WJF (DGGBAK) must be called.
The total number of floating point operations is approximately proportional to n2.
The complex analogue of this routine is F08WVF (ZGGBAL).

9  Example

See Section 9 in F08XEF (DHGEQZ) and F08YKF (DTGEVC).

F08WHF (DGGBAL) (PDF version)
F08 Chapter Contents
F08 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012