NAG Library Function Document
nag_zgebal (f08nvc) balances a complex general matrix in order to improve the accuracy of computed eigenvalues and/or eigenvectors.
||nag_zgebal (Nag_OrderType order,
nag_zgebal (f08nvc) balances a complex general matrix
. The term ‘balancing’ covers two steps, each of which involves a similarity transformation of
. The function can perform either or both of these steps.
||The function first attempts to permute to block upper triangular form by a similarity transformation:
where is a permutation matrix, and and are upper triangular. Then the diagonal elements of and are eigenvalues of . The rest of the eigenvalues of are the eigenvalues of the central diagonal block , in rows and columns to . Subsequent operations to compute the eigenvalues of (or its Schur factorization) need only be applied to these rows and columns; this can save a significant amount of work if and . If no suitable permutation exists (as is often the case), the function sets and , and is the whole of .
||The function applies a diagonal similarity transformation to , to make the rows and columns of as close in norm as possible:
This scaling can reduce the norm of the matrix (i.e., ) and hence reduce the effect of rounding errors on the accuracy of computed eigenvalues and eigenvectors.
Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore
order – Nag_OrderTypeInput
: 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
. See Section 188.8.131.52
in the Essential Introduction for a more detailed explanation of the use of this argument.
job – Nag_JobTypeInput
: indicates whether
is to be permuted and/or scaled (or neither).
- is neither permuted nor scaled (but values are assigned to ilo, ihi and scale).
- is permuted but not scaled.
- is scaled but not permuted.
- is both permuted and scaled.
, , or .
n – IntegerInput
On entry: , the order of the matrix .
a – ComplexInput/Output
the dimension, dim
, of the array a
must be at least
appears in this document, it refers to the array element
- when ;
- when .
On entry: the by matrix .
is overwritten by the balanced matrix. If
is not referenced.
pda – IntegerInput
: the stride separating row or column elements (depending on the value of order
) in the array a
ilo – Integer *Output
ihi – Integer *Output
: the values
such that on exit
is zero if
If or , and .
scale[n] – doubleOutput
: details of the permutations and scaling factors applied to
. More precisely, if
is the index of the row and column interchanged with row and column
is the scaling factor used to balance row and column
The order in which the interchanges are made is
fail – NagError *Input/Output
The NAG error argument (see Section 3.6
in the Essential Introduction).
6 Error Indicators and Warnings
Dynamic memory allocation failed.
On entry, argument had an illegal value.
On entry, .
On entry, .
On entry, and .
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
The errors are negligible, compared with those in subsequent computations.
8 Parallelism and Performance
nag_zgebal (f08nvc) is not threaded by NAG in any implementation.
nag_zgebal (f08nvc) 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 Users' Note
for your implementation for any additional implementation-specific information.
If the matrix
is balanced by nag_zgebal (f08nvc), then any eigenvectors computed subsequently are eigenvectors of the matrix
(see Section 3
) and hence nag_zgebak (f08nwc)
then be called to transform them back to eigenvectors of
If the Schur vectors of
are required, then this function must not
be called with
, because then the balancing transformation is not unitary. If this function is called with
, then any Schur vectors computed subsequently are Schur vectors of the matrix
, and nag_zgebak (f08nwc) must
be called (with
to transform them back to Schur vectors of
The total number of real floating-point operations is approximately proportional to .
The real analogue of this function is nag_dgebal (f08nhc)
This example computes all the eigenvalues and right eigenvectors of the matrix
The program first calls nag_zgebal (f08nvc) to balance the matrix; it then computes the Schur factorization of the balanced matrix, by reduction to Hessenberg form and the
algorithm. Then it calls nag_ztrevc (f08qxc)
to compute the right eigenvectors of the balanced matrix, and finally calls nag_zgebak (f08nwc)
to transform the eigenvectors back to eigenvectors of the original matrix
10.1 Program Text
Program Text (f08nvce.c)
10.2 Program Data
Program Data (f08nvce.d)
10.3 Program Results
Program Results (f08nvce.r)