naginterfaces.library.lapackeig.zggbal

naginterfaces.library.lapackeig.zggbal(job, n, a, b)[source]

zggbal balances a pair of complex square matrices of order . Balancing usually improves the accuracy of computed generalized eigenvalues and eigenvectors.

For full information please refer to the NAG Library document for f08wv

https://www.nag.com/numeric/nl/nagdoc_28.6/flhtml/f08/f08wvf.html

Parameters
jobstr, length 1

Specifies the operations to be performed on matrices and .

No balancing is done. Initialize , , and , for .

Only permutations are used in balancing.

Only scalings are are used in balancing.

Both permutations and scalings are used in balancing.

nint

, the order of the matrices and .

acomplex, array-like, shape

The matrix .

bcomplex, array-like, shape

The matrix .

Returns
acomplex, ndarray, shape

is overwritten by the balanced matrix. If , is not referenced.

bcomplex, ndarray, shape

is overwritten by the balanced matrix. If , is not referenced.

iloint

and are set such that and if and or .

If or , and .

ihiint

and are set such that and if and or .

If or , and .

lscalefloat, ndarray, shape

Details of the permutations and scaling factors applied to the left side of the matrices and . If is the index of the row interchanged with row and is the scaling factor applied to row , then

, for ;

, for ;

, for .

The order in which the interchanges are made is to , then to .

rscalefloat, ndarray, shape

Details of the permutations and scaling factors applied to the right side of the matrices and .

If is the index of the column interchanged with column and is the scaling factor applied to column , then

, for ;

, for ;

, for .

The order in which the interchanges are made is to , then to .

Raises
NagValueError
(errno )

On entry, error in parameter .

Constraint: , , or .

(errno )

On entry, error in parameter .

Constraint: .

Notes

Balancing may reduce the -norm of the matrices and improve the accuracy of the computed eigenvalues and eigenvectors in the complex generalized eigenvalue problem

zggbal 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 and . The function can perform either or both of these steps. Both steps are optional.

  1. The function first attempts to permute and to block upper triangular form by a similarity transformation:

    where is a permutation matrix, , , and are upper triangular. Then the diagonal elements of the matrix pairs and are generalized eigenvalues of . The rest of the generalized eigenvalues are given by the matrix pair which are in rows and columns to . Subsequent operations to compute the generalized eigenvalues of need only be applied to the matrix pair ; this can save a significant amount of work if and . If no suitable permutation exists (as is often the case), the function sets and .

  2. The function applies a diagonal similarity transformation to , to make the rows and columns of as close in norm as possible:

    This transformation usually improves the accuracy of computed generalized eigenvalues and eigenvectors.

References

Ward, R C, 1981, Balancing the generalized eigenvalue problem, SIAM J. Sci. Stat. Comp. (2), 141–152