F08NHF (DGEBAL) balances a real general matrix in order to improve the accuracy of computed eigenvalues and/or eigenvectors.
F08NHF (DGEBAL) balances a real general matrix
A. The term ‘balancing’ covers two steps, each of which involves a similarity transformation of
A. The routine can perform either or both of these steps.
- The routine first attempts to permute A to block upper triangular form by a similarity transformation:
where P is a permutation matrix, and A11′ and A33′ are upper triangular. Then the diagonal elements of A11′ and A33′ are eigenvalues of A. The rest of the eigenvalues of A are the eigenvalues of the central diagonal block A22′, in rows and columns ilo to ihi. Subsequent operations to compute the eigenvalues of A (or its Schur factorization) need only be applied to these rows and columns; 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, and A22′ is the whole of A.
- The routine applies a diagonal similarity transformation to A′, to make the rows and columns of A22′ as close in norm as possible:
This scaling can reduce the norm of the matrix (i.e., A22′′<A22′) 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
The errors are negligible.
If the matrix
A is balanced by F08NHF (DGEBAL), then any eigenvectors computed subsequently are eigenvectors of the matrix
A′′ (see
Section 3) and hence
F08NJF (DGEBAK)
must then be called to transform them back to eigenvectors of
A.
If the Schur vectors of
A are required, then this routine must
not be called with
JOB='S' or
'B', because then the balancing transformation is not orthogonal. If this routine is called with
JOB='P', then any Schur vectors computed subsequently are Schur vectors of the matrix
A′′, and
F08NJF (DGEBAK) must be called (with
SIDE='R')
to transform them back to Schur vectors of
A.
The complex analogue of this routine is
F08NVF (ZGEBAL).
This example computes all the eigenvalues and right eigenvectors of the matrix
A, 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
QR 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
A.