NAG Library Routine Document
f08nhf
(dgebal)
1
Purpose
f08nhf (dgebal) balances a real general matrix in order to improve the accuracy of computed eigenvalues and/or eigenvectors.
2
Specification
Fortran Interface
Integer, Intent (In) | :: |
n,
lda | Integer, Intent (Out) | :: |
ilo,
ihi,
info | Real (Kind=nag_wp), Intent (Inout) | :: |
a(lda,*) | Real (Kind=nag_wp), Intent (Out) | :: |
scale(n) | Character (1), Intent (In) | :: |
job |
|
C Header Interface
#include nagmk26.h
void |
f08nhf_ (
const char *job,
const Integer *n,
double a[],
const Integer *lda,
Integer *ilo,
Integer *ihi,
double scal[],
Integer *info,
const Charlen length_job) |
|
The routine may be called by its
LAPACK
name dgebal.
3
Description
f08nhf (dgebal) balances a real general matrix
. The term ‘balancing’ covers two steps, each of which involves a similarity transformation of
. The routine can perform either or both of these steps.
1. |
The routine 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 routine sets and , and is the whole of . |
2. |
The routine 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. |
4
References
Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore
5
Arguments
- 1: – Character(1)Input
-
On entry: 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.
Constraint:
, , or .
- 2: – IntegerInput
-
On entry: , the order of the matrix .
Constraint:
.
- 3: – Real (Kind=nag_wp) arrayInput/Output
-
Note: the second dimension of the array
a
must be at least
.
On entry: the by matrix .
On exit:
a is overwritten by the balanced matrix. If
,
a is not referenced.
- 4: – IntegerInput
-
On entry: the first dimension of the array
a as declared in the (sub)program from which
f08nhf (dgebal) is called.
Constraint:
.
- 5: – IntegerOutput
- 6: – IntegerOutput
-
On exit: the values
and
such that on exit
is zero if
and
or
.
If or , and .
- 7: – Real (Kind=nag_wp) arrayOutput
-
On exit: 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
and
is the scaling factor used to balance row and column
then
The order in which the interchanges are made is
to
then
to
.
- 8: – IntegerOutput
On exit:
unless the routine detects an error (see
Section 6).
6
Error Indicators and Warnings
-
If , argument had an illegal value. An explanatory message is output, and execution of the program is terminated.
7
Accuracy
The errors are negligible.
8
Parallelism and Performance
f08nhf (dgebal) 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.
If the matrix
is balanced by
f08nhf (dgebal), then any eigenvectors computed subsequently are eigenvectors of the matrix
(see
Section 3) and hence
f08njf (dgebak)
must then be called to transform them back to eigenvectors of
.
If the Schur vectors of
are required, then this routine must
not be called with
or
, because then the balancing transformation is not orthogonal. If this routine is called with
, then any Schur vectors computed subsequently are Schur vectors of the matrix
, and
f08njf (dgebak) must be called (with
)
to transform them back to Schur vectors of
.
The total number of floating-point operations is approximately proportional to .
The complex analogue of this routine is
f08nvf (zgebal).
10
Example
This example computes all the eigenvalues and right eigenvectors of the matrix
, where
The program first calls
f08nhf (dgebal) 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
f08qkf (dtrevc) to compute the right eigenvectors of the balanced matrix, and finally calls
f08njf (dgebak) to transform the eigenvectors back to eigenvectors of the original matrix
.
10.1
Program Text
Program Text (f08nhfe.f90)
10.2
Program Data
Program Data (f08nhfe.d)
10.3
Program Results
Program Results (f08nhfe.r)