NAG Library Function Document

nag_zggbal (f08wvc)

 Contents

    1  Purpose
    7  Accuracy
    10  Example

1
Purpose

nag_zggbal (f08wvc) 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

#include <nag.h>
#include <nagf08.h>
void  nag_zggbal (Nag_OrderType order, Nag_JobType job, Integer n, Complex a[], Integer pda, Complex b[], Integer pdb, Integer *ilo, Integer *ihi, double lscale[], double rscale[], NagError *fail)

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.  
nag_zggbal (f08wvc) 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 function can perform either or both of these steps. Both steps are optional.
1. The function 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 function sets ilo=1 and ihi=n.
2. The function 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:     order Nag_OrderTypeInput
On entry: the order argument specifies the two-dimensional storage scheme being used, i.e., row-major ordering or column-major ordering. C language defined storage is specified by order=Nag_RowMajor. See Section 3.3.1.3 in How to Use the NAG Library and its Documentation for a more detailed explanation of the use of this argument.
Constraint: order=Nag_RowMajor or Nag_ColMajor.
2:     job Nag_JobTypeInput
On entry: specifies the operations to be performed on matrices A and B.
job=Nag_DoNothing
No balancing is done. Initialize ilo=1, ihi=n, lscale[i-1]=1.0 and rscale[i-1]=1.0, for i=1,2,,n.
job=Nag_Permute
Only permutations are used in balancing.
job=Nag_Scale
Only scalings are are used in balancing.
job=Nag_DoBoth
Both permutations and scalings are used in balancing.
Constraint: job=Nag_DoNothing, Nag_Permute, Nag_Scale or Nag_DoBoth.
3:     n IntegerInput
On entry: n, the order of the matrices A and B.
Constraint: n0.
4:     a[dim] ComplexInput/Output
Note: the dimension, dim, of the array a must be at least max1,pda×n.
Where Ai,j appears in this document, it refers to the array element
  • a[j-1×pda+i-1] when order=Nag_ColMajor;
  • a[i-1×pda+j-1] when order=Nag_RowMajor.
On entry: the n by n matrix A.
On exit: a is overwritten by the balanced matrix. If job=Nag_DoNothing, a is not referenced.
5:     pda IntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array a.
Constraint: pdamax1,n.
6:     b[dim] ComplexInput/Output
Note: the dimension, dim, of the array b must be at least max1,pdb×n.
Where Bi,j appears in this document, it refers to the array element
  • b[j-1×pdb+i-1] when order=Nag_ColMajor;
  • b[i-1×pdb+j-1] when order=Nag_RowMajor.
On entry: the n by n matrix B.
On exit: b is overwritten by the balanced matrix. If job=Nag_DoNothing, b is not referenced.
7:     pdb IntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array b.
Constraint: pdbmax1,n.
8:     ilo Integer *Output
9:     ihi Integer *Output
On exit: ilo and ihi are set such that Ai,j=0 and Bi,j=0 if i>j and 1j<ilo or ihi<in.
If job=Nag_DoNothing or Nag_Scale, ilo=1 and ihi=n.
10:   lscale[n] doubleOutput
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-1]=Pi, for i=1,2,,ilo-1;
  • lscale[i-1]=di, for i=ilo,,ihi;
  • lscale[i-1]=Pi, for i=ihi+1,,n.
The order in which the interchanges are made is n to ihi+1, then 1 to ilo-1.
11:   rscale[n] doubleOutput
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-1]=Pj, for j=1,2,,ilo-1;
  • rscale[j-1]=d^j, for j=ilo,,ihi;
  • rscale[j-1]=Pj, for j=ihi+1,,n.
The order in which the interchanges are made is n to ihi+1, then 1 to ilo-1.
12:   fail NagError *Input/Output
The NAG error argument (see Section 3.7 in How to Use the NAG Library and its Documentation).

6
Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_INT
On entry, n=value.
Constraint: n0.
On entry, pda=value.
Constraint: pda>0.
On entry, pdb=value.
Constraint: pdb>0.
NE_INT_2
On entry, pda=value and n=value.
Constraint: pdamax1,n.
On entry, pdb=value and n=value.
Constraint: pdbmax1,n.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.

7
Accuracy

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

8
Parallelism and Performance

nag_zggbal (f08wvc) 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 function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9
Further Comments

nag_zggbal (f08wvc) 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 function nag_zgeqrf (f08asc) and the unitary transformation Q is applied to the matrix A by calling nag_zunmqr (f08auc). This is followed by nag_zgghrd (f08wsc) which reduces the matrix pair into the generalized Hessenberg form.
If the matrix pair A,B is balanced by this function, 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, nag_zggbak (f08wwc) must be called.
The total number of floating-point operations is approximately proportional to n2.
The real analogue of this function is nag_dggbal (f08whc).

10
Example

See Section 10 in nag_zhgeqz (f08xsc) and nag_ztgevc (f08yxc).
© The Numerical Algorithms Group Ltd, Oxford, UK. 2017