NAG Library Routine Document

f08whf  (dggbal)

 Contents

    1  Purpose
    7  Accuracy
    10  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

Fortran Interface
Subroutine f08whf ( job, n, a, lda, b, ldb, ilo, ihi, lscale, rscale, work, info)
Integer, Intent (In):: n, lda, ldb
Integer, Intent (Out):: ilo, ihi, info
Real (Kind=nag_wp), Intent (Inout):: a(lda,*), b(ldb,*), work(*)
Real (Kind=nag_wp), Intent (Out):: lscale(n), rscale(n)
Character (1), Intent (In):: job
C Header Interface
#include nagmk26.h
void  f08whf_ ( const char *job, const Integer *n, double a[], const Integer *lda, double b[], const Integer *ldb, Integer *ilo, Integer *ihi, double lscale[], double rscale[], double work[], Integer *info, const Charlen length_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
Arguments

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:     alda* – 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:     bldb* – 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:     lscalen – 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:   rscalen – 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

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
Parallelism and Performance

f08whf (dggbal) makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9
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).

10
Example

See Section 10 in f08xef (dhgeqz) and f08ykf (dtgevc).
© The Numerical Algorithms Group Ltd, Oxford, UK. 2017