Developer Reference for Intel® oneAPI Math Kernel Library for Fortran

ID 766686
Date 3/31/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

?gebal

Balances a general matrix to improve the accuracy of computed eigenvalues and eigenvectors.

Syntax

call sgebal(job, n, a, lda, ilo, ihi, scale, info)

call dgebal(job, n, a, lda, ilo, ihi, scale, info)

call cgebal(job, n, a, lda, ilo, ihi, scale, info)

call zgebal(job, n, a, lda, ilo, ihi, scale, info)

call gebal(a [, scale] [,ilo] [,ihi] [,job] [,info])

Include Files
  • mkl.fi, lapack.f90
Description

The routine balances a matrix A by performing either or both of the following two similarity transformations:

(1) The routine first attempts to permute A to block upper triangular form:


Equation

where P is a permutation matrix, and A'11 and A'33 are upper triangular. The diagonal elements of A'11 and A'33 are eigenvalues of A. The rest of the eigenvalues of A are the eigenvalues of the central diagonal block A'22, 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 A'22 is the whole of A.

(2) The routine applies a diagonal similarity transformation to A', to make the rows and columns of A'22 as close in norm as possible:


Equation

This scaling can reduce the norm of the matrix (that is, ||A''22|| < ||A'22||), and hence reduce the effect of rounding errors on the accuracy of computed eigenvalues and eigenvectors.

Input Parameters
job

CHARACTER*1. Must be 'N' or 'P' or 'S' or 'B'.

If job = 'N', then A is neither permuted nor scaled (but ilo, ihi, and scale get their values).

If job = 'P', then A is permuted but not scaled.

If job = 'S', then A is scaled but not permuted.

If job = 'B', then A is both scaled and permuted.

n

INTEGER. The order of the matrix A (n 0).

a

REAL for sgebal

DOUBLE PRECISION for dgebal

COMPLEX for cgebal

DOUBLE COMPLEX for zgebal.

Array a(lda,*) contains the matrix A.

The second dimension of a must be at least max(1, n). a is not referenced if job = 'N'.

lda

INTEGER. The leading dimension of a; at least max(1, n).

Output Parameters
a

Overwritten by the balanced matrix (a is not referenced if job = 'N').

ilo, ihi

INTEGER. The values ilo and ihi such that on exit a(i,j) is zero if i > j and 1 j < ilo or ihi < jn.

If job = 'N' or 'S', then ilo = 1 and ihi = n.

scale

REAL for single-precision flavors DOUBLE PRECISION for double-precision flavors

Array, size at least max(1, n).

Contains details of the permutations and scaling factors.

More precisely, if pj is the index of the row and column interchanged with row and column j, and dj is the scaling factor used to balance row and column j, then

scale(j) = pj for j = 1, 2,..., ilo-1, ihi+1,..., n;

scale(j) = dj for j = ilo, ilo + 1,..., ihi.

The order in which the interchanges are made is n to ihi+1, then 1 to ilo-1.

info

INTEGER.

If info = 0, the execution is successful.

If info = -i, the i-th parameter had an illegal value.

LAPACK 95 Interface Notes

Routines in Fortran 95 interface have fewer arguments in the calling sequence than their FORTRAN 77 counterparts. For general conventions applied to skip redundant or restorable arguments, see LAPACK 95 Interface Conventions.

Specific details for the routine gebal interface are the following:

a

Holds the matrix A of size (n,n).

scale

Holds the vector of length n.

ilo

Default value for this argument is ilo = 1.

ihi

Default value for this argument is ihi = n.

job

Must be 'B', 'S', 'P', or 'N'. The default value is 'B'.

Application Notes

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

If the matrix A is balanced by this routine, then any eigenvectors computed subsequently are eigenvectors of the matrix A'' and hence you must call gebak to transform them back to eigenvectors of A.

If the Schur vectors of A are required, do not call this routine with job = 'S' or 'B', because then the balancing transformation is not orthogonal (not unitary for complex flavors).

If you call this routine with job = 'P', then any Schur vectors computed subsequently are Schur vectors of the matrix A'', and you need to call gebak (with side = 'R') to transform them back to Schur vectors of A.

The total number of floating-point operations is proportional to n2.