NAG FL Interface
f08wvf (zggbal)

Settings help

FL Name Style:


FL Specification Language:


1 Purpose

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

2 Specification

Fortran Interface
Subroutine f08wvf ( 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 (Out) :: lscale(n), rscale(n), work(6*n)
Complex (Kind=nag_wp), Intent (Inout) :: a(lda,*), b(ldb,*)
Character (1), Intent (In) :: job
C Header Interface
#include <nag.h>
void  f08wvf_ (const char *job, const Integer *n, Complex a[], const Integer *lda, Complex 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 the names f08wvf, nagf_lapackeig_zggbal or its LAPACK name zggbal.

3 Description

Balancing may reduce the 1-norm of the matrices and improve the accuracy of the computed eigenvalues and eigenvectors in the complex generalized eigenvalue problem
Ax=λBx.  
f08wvf 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. 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. 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-1= ( 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, lscale(i)=1.0 and rscale(i)=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 Integer Input
On entry: n, the order of the matrices A and B.
Constraint: n0.
3: a(lda,*) Complex (Kind=nag_wp) array Input/Output
Note: the second dimension of the array a must be at least max(1,n).
On entry: the n×n matrix A.
On exit: a is overwritten by the balanced matrix. If job='N', a is not referenced.
4: lda Integer Input
On entry: the first dimension of the array a as declared in the (sub)program from which f08wvf is called.
Constraint: ldamax(1,n).
5: b(ldb,*) Complex (Kind=nag_wp) array Input/Output
Note: the second dimension of the array b must be at least max(1,n).
On entry: the n×n matrix B.
On exit: b is overwritten by the balanced matrix. If job='N', b is not referenced.
6: ldb Integer Input
On entry: the first dimension of the array b as declared in the (sub)program from which f08wvf is called.
Constraint: ldbmax(1,n).
7: ilo Integer Output
8: ihi Integer Output
On exit: ilo and ihi are set such that a(i,j)=0 and b(i,j)=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) array Output
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
  • lscale(i)=Pi, for i=1,2,,ilo-1;
  • lscale(i)=di, for i=ilo,,ihi;
  • lscale(i)=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) array Output
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
  • rscale(j)=Pj, for j=1,2,,ilo-1;
  • rscale(j)=d^j, for j=ilo,,ihi;
  • rscale(j)=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(6×n) Real (Kind=nag_wp) array Workspace
12: info Integer Output
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

Background information to multithreading can be found in the Multithreading documentation.
f08wvf 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

f08wvf is usually the first step in computing the complex generalized eigenvalue problem but it is an optional step. The matrix B is reduced to the triangular form using the QR factorization routine f08asf and the unitary transformation Q is applied to the matrix A by calling f08auf. This is followed by f08wtf 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, f08wwf must be called.
The total number of floating-point operations is approximately proportional to n2.
The real analogue of this routine is f08whf.

10 Example

See Section 10 in f08xsf and f08yxf.