NAG Library Routine Document
f02sdf
(withdraw_real_band_geneig)
1
Purpose
f02sdf finds the eigenvector corresponding to a given real eigenvalue for the generalized problem , or for the standard problem , where and are real band matrices.
2
Specification
Fortran Interface
Subroutine f02sdf ( |
n,
ma1,
mb1,
a,
lda,
b,
ldb,
sym,
relep,
rmu,
vec,
d,
iwork,
work,
lwork,
ifail) |
Integer, Intent (In) | :: |
n,
ma1,
mb1,
lda,
ldb,
lwork | Integer, Intent (Inout) | :: |
ifail | Integer, Intent (Out) | :: |
iwork(n) | Real (Kind=nag_wp), Intent (In) | :: |
relep,
rmu | Real (Kind=nag_wp), Intent (Inout) | :: |
a(lda,n),
b(ldb,n),
d(30) | Real (Kind=nag_wp), Intent (Out) | :: |
vec(n),
work(lwork) | Logical, Intent (In) | :: |
sym |
|
C Header Interface
#include nagmk26.h
void |
f02sdf_ (
const Integer *n,
const Integer *ma1,
const Integer *mb1,
double a[],
const Integer *lda,
double b[],
const Integer *ldb,
const logical *sym,
const double *relep,
const double *rmu,
double vec[],
double d[],
Integer iwork[],
double work[],
const Integer *lwork,
Integer *ifail) |
|
3
Description
Given an approximation to a real eigenvalue of the generalized eigenproblem , f02sdf attempts to compute the corresponding eigenvector by inverse iteration.
f02sdf first computes lower and upper triangular factors, and , of , using Gaussian elimination with interchanges, and then solves the equation , where – this is the first half iteration.
There are then three possible courses of action depending on the input value of
.
1. |
.
This setting should be used if is an ill-conditioned eigenvalue (provided the matrix elements do not vary widely in order of magnitude). In this case it is essential to accept only a vector found after one half iteration, and must be a very good approximation to . If acceptable growth is achieved in the solution of , then the normalized is accepted as the eigenvector. If not, columns of an orthogonal matrix are tried in turn in place of . If none of these give acceptable growth, the routine fails, indicating that was not a sufficiently good approximation to . |
2. |
.
This setting should be used if is moderately close to an eigenvalue which is not ill-conditioned (provided the matrix elements do not differ widely in order of magnitude). If acceptable growth is achieved in the solution of , the normalized is accepted as the eigenvector. If not, inverse iteration is performed. Up to iterations are allowed to achieve a vector and a correction to which together give acceptably small residuals. |
3. |
.
This setting should be used if the elements of and vary widely in order of magnitude. Inverse iteration is performed, but a different convergence criterion is used. |
See
Section 9.3 for further details.
Note that the bandwidth of the matrix must not be less than the bandwidth of . If this is not so, either must be filled out with zeros, or matrices and may be reversed and supplied as an approximation to the eigenvalue . Also it is assumed that and each have the same number of subdiagonals as superdiagonals. If this is not so, they must be filled out with zeros. If and are both symmetric, only the upper triangles need be supplied.
4
References
Peters G and Wilkinson J H (1979) Inverse iteration, ill-conditioned equations and Newton's method SIAM Rev. 21 339–360
Wilkinson J H (1965) The Algebraic Eigenvalue Problem Oxford University Press, Oxford
Wilkinson J H (1972) Inverse iteration in theory and practice Symposia Mathematica Volume X 361–379 Istituto Nazionale di Alta Matematica, Monograf, Bologna
Wilkinson J H (1974) Notes on inverse iteration and ill-conditioned eigensystems Acta Univ. Carolin. Math. Phys. 1–2 173–177
Wilkinson J H (1979) Kronecker's canonical form and the algorithm Linear Algebra Appl. 28 285–303
5
Arguments
- 1: – IntegerInput
-
On entry: , the order of the matrices and .
Constraint:
.
- 2: – IntegerInput
-
On entry: the value , where is the number of nonzero lines on each side of the diagonal of . Thus the total bandwidth of is .
Constraint:
.
- 3: – IntegerInput
-
On entry: if
,
is assumed to be the unit matrix. Otherwise
mb1 must specify the value
, where
is the number of nonzero lines on each side of the diagonal of
. Thus the total bandwidth of
is
.
Constraint:
.
- 4: – Real (Kind=nag_wp) arrayInput/Output
-
On entry: the
by
band matrix
. The
subdiagonals must be stored in the first
rows of the array; the diagonal in the (
)th row; and the
superdiagonals in rows
to
. Each row of the matrix must be stored in the corresponding column of the array. For example, if
and
the storage scheme is:
Elements of the array marked
need not be set. The following code assigns the matrix elements within the band to the correct elements of the array:
Do 20 j = 1, n
Do 10 i = max(1,j-MA1+1), min(n,j+MA1-1)
a(i-j+MA1,j) = matrix(j,i)
10 Continue
20 Continue
If
(i.e., both
and
are symmetric), only the lower triangle of
need be stored in the first
ma1 rows of the array.
On exit: details of the factorization of , where is an estimate of the eigenvalue.
- 5: – IntegerInput
-
On entry: the first dimension of the array
a as declared in the (sub)program from which
f02sdf is called.
Constraint:
.
- 6: – Real (Kind=nag_wp) arrayInput/Output
-
On entry: if
,
b must contain the
by
band matrix
, stored in the same way as
. If
, only the lower triangle of
need be stored in the first
mb1 rows of the array.
If , the array is not used.
On exit: elements in the top-left corner, and in the bottom right corner if , are set to zero; otherwise the array is unchanged.
- 7: – IntegerInput
-
On entry: the first dimension of the array
b as declared in the (sub)program from which
f02sdf is called.
Constraints:
- if , ;
- if , .
- 8: – LogicalInput
-
On entry: if
, both
and
are assumed to be symmetric and only their upper triangles need be stored. Otherwise
sym must be set to .FALSE..
- 9: – Real (Kind=nag_wp)Input
-
On entry: the relative error of the coefficients of the given matrices
and
. If the value of
relep is less than the
machine precision, the
machine precision is used instead.
- 10: – Real (Kind=nag_wp)Input
-
On entry: , an approximation to the eigenvalue for which the corresponding eigenvector is required.
- 11: – Real (Kind=nag_wp) arrayOutput
-
On exit: the eigenvector, normalized so that the largest element is unity, corresponding to the improved eigenvalue .
- 12: – Real (Kind=nag_wp) arrayInput/Output
-
On entry:
must be set to indicate the type of problem (see
Section 3):
- Indicates a well-conditioned eigenvalue.
- Indicates an ill-conditioned eigenvalue.
- Indicates that the matrices have elements varying widely in order of magnitude.
On exit: if
on entry, the successive corrections to
are given in
, for
, where
is the total number of iterations performed. The final correction is also given in the last position,
, of the array. The remaining elements of
d are set to zero.
If on entry, no corrections to are computed and
is set to , for . Thus in all three cases the best available approximation to the eigenvalue is .
- 13: – Integer arrayWorkspace
- 14: – Real (Kind=nag_wp) arrayWorkspace
- 15: – IntegerInput
-
On entry: the dimension of the array
work as declared in the (sub)program from which
f02sdf is called.
Constraints:
- if , ;
- if , .
- 16: – IntegerInput/Output
-
On entry:
ifail must be set to
,
. If you are unfamiliar with this argument you should refer to
Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this argument, the recommended value is
.
When the value is used it is essential to test the value of ifail on exit.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
6
Error Indicators and Warnings
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
x04aaf).
Errors or warnings detected by the routine:
-
On entry, | , |
or | , |
or | , |
or | , |
or | when , |
or | when (ldb is not checked if ). |
-
On entry, | . Either fill out a with zeros, or reverse the roles of a and b, and replace rmu by its reciprocal, i.e., solve |
-
On entry, | when , |
or | when . |
-
is null. If
is nonsingular, all the eigenvalues are zero and any set of
n orthogonal vectors forms the eigensolution.
-
is null. If is nonsingular, all the eigenvalues are infinite, and the columns of the unit matrix are eigenvectors.
-
On entry, | and are both null. The eigensolution is arbitrary. |
-
on entry and convergence is not achieved in
iterations. Either the eigenvalue is ill-conditioned or
rmu is a poor approximation to the eigenvalue. See
Section 9.3.
-
on entry and no eigenvector has been found after
back-substitutions.
rmu is not a sufficiently good approximation to the eigenvalue.
-
on entry and
rmu is too inaccurate for the solution to converge.
An unexpected error has been triggered by this routine. Please
contact
NAG.
See
Section 3.9 in How to Use the NAG Library and its Documentation for further information.
Your licence key may have expired or may not have been installed correctly.
See
Section 3.8 in How to Use the NAG Library and its Documentation for further information.
Dynamic memory allocation failed.
See
Section 3.7 in How to Use the NAG Library and its Documentation for further information.
7
Accuracy
The eigensolution is exact for some problem
where
are of the order of
, where
is the value used for
relep.
8
Parallelism and Performance
f02sdf is not threaded in any implementation.
The time taken by f02sdf is approximately proportional to for factorization, and to for each iteration.
The storage of the matrices and is designed for efficiency on a paged machine.
f02sdf will work with full matrices but it will do so inefficiently, particularly in respect of storage requirements.
Inverse iteration is performed according to the rule
where
is the element of
of largest magnitude.
Thus:
Hence the residual corresponding to
is very small if
is very large (see
Peters and Wilkinson (1979)). The first half iteration,
, corresponds to taking
.
If
is a very accurate eigenvalue, then there should always be an initial vector
such that one half iteration gives a small residual and thus a good eigenvector. If the eigenvalue is ill-conditioned, then second and subsequent iterated vectors may not be even remotely close to an eigenvector of a neighbouring problem (see pages 374–376 of
Wilkinson (1972) and
Wilkinson (1974)). In this case it is essential to accept only a vector obtained after one half iteration.
However, for well-conditioned eigenvalues, there is no loss in performing more than one iteration (see page 376 of
Wilkinson (1972)), and indeed it will be necessary to iterate if
is not such a good approximation to the eigenvalue. When the iteration has converged,
will be some multiple of
,
, say.
Therefore
giving
Thus
is a better approximation to the eigenvalue.
is obtained as the element of
which corresponds to the element of largest magnitude,
, in
. The routine terminates when
is of the order of the
machine precision relative to
.
If the elements of and vary widely in order of magnitude, then and are excessively large and a different convergence test is required. The routine terminates when the difference between successive corrections to is small relative to .
In practice one does not necessarily know if the given problem is well-conditioned or ill-conditioned. In order to provide some information on the condition of the eigenvalue or the accuracy of
in the event of failure, successive values of
are stored in the vector
d when
is nonzero on input. If these values appear to be converging steadily, then it is likely that
was a poor approximation to the eigenvalue and it is worth trying again with
as the initial approximation. If the values in
d vary considerably in magnitude, then the eigenvalue is ill-conditioned.
A discussion of the significance of the singularity of
and/or
is given in relation to the
algorithm in
Wilkinson (1979).
10
Example
Given the generalized eigenproblem
where
find the eigenvector corresponding to the approximate eigenvalue
.
Although
is symmetric,
is not, so
sym must be set to .FALSE. and all the elements of
in the band must be supplied to the routine.
(as written above) has
subdiagonal and
superdiagonals, so
ma1 must be set to
and
filled out with an additional subdiagonal of zeros. Each row of the matrices is read in as data in turn.
10.1
Program Text
Program Text (f02sdfe.f90)
10.2
Program Data
Program Data (f02sdfe.d)
10.3
Program Results
Program Results (f02sdfe.r)