nag_dggbal (f08whc) balances a pair of real square matrices of order . Balancing usually improves the accuracy of computed generalized eigenvalues and eigenvectors.
Balancing may reduce the -norms of the matrices and improve the accuracy of the computed eigenvalues and eigenvectors in the real generalized eigenvalue problem
nag_dggbal (f08whc) 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.
4
References
Ward R C (1981) Balancing the generalized eigenvalue problem SIAM J. Sci. Stat. Comp.2 141–152
5
Arguments
1:
– Nag_OrderTypeInput
On entry: 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 3.3.1.3 in How to Use the NAG Library and its Documentation for a more detailed explanation of the use of this argument.
Constraint:
or .
2:
– Nag_JobTypeInput
On entry: 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.
Constraint:
, , or .
3:
– IntegerInput
On entry: , the order of the matrices and .
Constraint:
.
4:
– doubleInput/Output
Note: the dimension, dim, of the array a
must be at least
.
Where appears in this document, it refers to the array element
when ;
when .
On entry: the by matrix .
On exit: a is overwritten by the balanced matrix. If , a is not referenced.
5:
– IntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array a.
Constraint:
.
6:
– doubleInput/Output
Note: the dimension, dim, of the array b
must be at least
.
Where appears in this document, it refers to the array element
when ;
when .
On entry: the by matrix .
On exit: b is overwritten by the balanced matrix. If , b is not referenced.
7:
– IntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array b.
Constraint:
.
8:
– Integer *Output
9:
– Integer *Output
On exit: and are set such that and if and or .
If or , and .
10:
– doubleOutput
On exit: 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 .
11:
– doubleOutput
On exit: 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 .
12:
– NagError *Input/Output
The NAG error argument (see Section 3.7 in How to Use the NAG Library and its Documentation).
6
Error Indicators and Warnings
NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
NE_BAD_PARAM
On entry, argument had an illegal value.
NE_INT
On entry, .
Constraint: .
On entry, . Constraint: .
On entry, . Constraint: .
NE_INT_2
On entry, and .
Constraint: .
On entry, and .
Constraint: .
NE_INTERNAL_ERROR
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 for assistance.
See Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.
7
Accuracy
The errors are negligible, compared to those in subsequent computations.
8
Parallelism and Performance
nag_dggbal (f08whc) 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 function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.
9
Further Comments
nag_dggbal (f08whc) is usually the first step in computing the real generalized eigenvalue problem but it is an optional step. The matrix is reduced to the upper triangular form using the factorization function nag_dgeqrf (f08aec) and this orthogonal transformation is applied to the matrix by calling nag_dormqr (f08agc). This is followed by nag_dgghrd (f08wec) which reduces the matrix pair into the generalized Hessenberg form.
If the matrix pair is balanced by this function, then any generalized eigenvectors computed subsequently are eigenvectors of the balanced matrix pair. In that case, to compute the generalized eigenvectors of the original matrix, nag_dggbak (f08wjc) must be called.
The total number of floating-point operations is approximately proportional to .