PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_lapack_zggbal (f08wv)
Purpose
nag_lapack_zggbal (f08wv) balances a pair of complex square matrices of order . Balancing usually improves the accuracy of computed generalized eigenvalues and eigenvectors.
Syntax
[
a,
b,
ilo,
ihi,
lscale,
rscale,
info] = f08wv(
job,
a,
b, 'n',
n)
[
a,
b,
ilo,
ihi,
lscale,
rscale,
info] = nag_lapack_zggbal(
job,
a,
b, 'n',
n)
Description
Balancing may reduce the
-norm of the matrices and improve the accuracy of the computed eigenvalues and eigenvectors in the complex generalized eigenvalue problem
nag_lapack_zggbal (f08wv) 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
Parameters
Compulsory Input Parameters
- 1:
– string (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.
Constraint:
, , or .
- 2:
– complex array
-
The first dimension of the array
a must be at least
.
The second dimension of the array
a must be at least
.
The by matrix .
- 3:
– complex array
-
The first dimension of the array
b must be at least
.
The second dimension of the array
b must be at least
.
The by matrix .
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the first dimension of the arrays
a,
b and the second dimension of the arrays
a,
b.
, the order of the matrices and .
Constraint:
.
Output Parameters
- 1:
– complex array
-
The first dimension of the array
a will be
.
The second dimension of the array
a will be
.
a stores the balanced matrix. If
,
a is not referenced.
- 2:
– complex array
-
The first dimension of the array
b will be
.
The second dimension of the array
b will be
.
b stores the balanced matrix. If
,
b is not referenced.
- 3:
– int64int32nag_int scalar
- 4:
– int64int32nag_int scalar
-
and
are set such that
and
if
and
or
.
If or , and .
- 5:
– double array
-
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 .
- 6:
– double array
-
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 .
- 7:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
-
If , parameter had an illegal value on entry. The parameters are numbered as follows:
1:
job, 2:
n, 3:
a, 4:
lda, 5:
b, 6:
ldb, 7:
ilo, 8:
ihi, 9:
lscale, 10:
rscale, 11:
work, 12:
info.
It is possible that
info refers to a parameter that is omitted from the MATLAB interface. This usually indicates that an error in one of the other input parameters has caused an incorrect value to be inferred.
Accuracy
The errors are negligible, compared to those in subsequent computations.
Further Comments
nag_lapack_zggbal (f08wv) is usually the first step in computing the complex generalized eigenvalue problem but it is an optional step. The matrix
is reduced to the triangular form using the
factorization function
nag_lapack_zgeqrf (f08as) and the unitary transformation
is applied to the matrix
by calling
nag_lapack_zunmqr (f08au). This is followed by
nag_lapack_zgghrd (f08ws) 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_lapack_zggbak (f08ww) must be called.
The total number of floating-point operations is approximately proportional to .
The real analogue of this function is
nag_lapack_dggbal (f08wh).
Example
Open in the MATLAB editor:
f08wv_example
function f08wv_example
fprintf('f08wv example results\n\n');
job = 'B';
a = [ 1 + 3i, 1 + 4i, 1 + 5i, 1 + 6i;
2 + 2i, 4 + 3i, 8 + 4i, 16 + 5i;
3 + 1i, 9 + 2i, 27 + 3i, 81 + 4i;
4 + 0i, 16 + 1i, 64 + 2i, 256 + 3i];
b = [ 1, 2 + 1i, 3 + 2i, 4 + 3i;
1 + 1i, 4 + 2i, 9 + 3i, 16 + 4i;
1 + 2i, 8 + 3i, 27 + 4i, 64 + 5i;
1 + 3i, 16 + 4i, 81 + 5i, 256 + 6i];
[abal, bbal, ilo, ihi, lscale, rscale, info] = ...
f08wv(job, a, b);
disp('Balanced A:');
disp(abal);
disp('Balanced B:');
disp(bbal);
disp('Scaling factors:');
disp(' Left Right');
disp([lscale rscale]);
f08wv example results
Balanced A:
1.0000 + 3.0000i 1.0000 + 4.0000i 0.1000 + 0.5000i 0.1000 + 0.6000i
2.0000 + 2.0000i 4.0000 + 3.0000i 0.8000 + 0.4000i 1.6000 + 0.5000i
0.3000 + 0.1000i 0.9000 + 0.2000i 0.2700 + 0.0300i 0.8100 + 0.0400i
0.4000 + 0.0000i 1.6000 + 0.1000i 0.6400 + 0.0200i 2.5600 + 0.0300i
Balanced B:
1.0000 + 0.0000i 2.0000 + 1.0000i 0.3000 + 0.2000i 0.4000 + 0.3000i
1.0000 + 1.0000i 4.0000 + 2.0000i 0.9000 + 0.3000i 1.6000 + 0.4000i
0.1000 + 0.2000i 0.8000 + 0.3000i 0.2700 + 0.0400i 0.6400 + 0.0500i
0.1000 + 0.3000i 1.6000 + 0.4000i 0.8100 + 0.0500i 2.5600 + 0.0600i
Scaling factors:
Left Right
1.0000 1.0000
1.0000 1.0000
0.1000 0.1000
0.1000 0.1000
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015