NAG Library Function Document
nag_dhseqr (f08pec)
1 Purpose
nag_dhseqr (f08pec) computes all the eigenvalues and, optionally, the Schur factorization of a real Hessenberg matrix or a real general matrix which has been reduced to Hessenberg form.
2 Specification
| #include <nag.h> |
| #include <nagf08.h> |
| void |
nag_dhseqr (Nag_OrderType order,
Nag_JobType job,
Nag_ComputeZType compz,
Integer n,
Integer ilo,
Integer ihi,
double h[],
Integer pdh,
double wr[],
double wi[],
double z[],
Integer pdz,
NagError *fail) |
|
3 Description
nag_dhseqr (f08pec) computes all the eigenvalues and, optionally, the Schur factorization of a real upper Hessenberg matrix
:
where
is an upper quasi-triangular matrix (the Schur form of
), and
is the orthogonal matrix whose columns are the Schur vectors
. See
Section 8 for details of the structure of
.
The function may also be used to compute the Schur factorization of a real general matrix
which has been reduced to upper Hessenberg form
:
In this case, after
nag_dgehrd (f08nec) has been called to reduce
to Hessenberg form,
nag_dorghr (f08nfc) must be called to form
explicitly;
is then passed to nag_dhseqr (f08pec), which must be called with
.
The function can also take advantage of a previous call to
nag_dgebal (f08nhc) which may have balanced the original matrix before reducing it to Hessenberg form, so that the Hessenberg matrix
has the structure:
where
and
are upper triangular. If so, only the central diagonal block
(in rows and columns
to
) needs to be further reduced to Schur form (the blocks
and
are also affected). Therefore the values of
and
can be supplied to nag_dhseqr (f08pec) directly. Also,
nag_dgebak (f08njc) must be called after this function to permute the Schur vectors of the balanced matrix to those of the original matrix. If
nag_dgebal (f08nhc) has not been called however, then
must be set to
and
to
. Note that if the Schur factorization of
is required,
nag_dgebal (f08nhc) must
not be called with
or
, because the balancing transformation is not orthogonal.
nag_dhseqr (f08pec) uses a multishift form of the upper Hessenberg
algorithm, due to
Bai and Demmel (1989). The Schur vectors are normalized so that
, but are determined only to within a factor
.
4 References
Bai Z and Demmel J W (1989) On a block implementation of Hessenberg multishift iteration Internat. J. High Speed Comput. 1 97–112
Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore
5 Arguments
- 1:
order – 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.2.1.3 in the Essential Introduction for a more detailed explanation of the use of this argument.
Constraint:
or Nag_ColMajor.
- 2:
job – Nag_JobTypeInput
-
On entry: indicates whether eigenvalues only or the Schur form
is required.
- Eigenvalues only are required.
- The Schur form is required.
Constraint:
or .
- 3:
compz – Nag_ComputeZTypeInput
-
On entry: indicates whether the
Schur vectors
are to be computed.
- No Schur vectors
are computed (and the array z is not referenced).
- The
Schur vectors of are computed (and the array z is initialized by the function).
- The
Schur vectors
of are computed (and the array z must contain the matrix on entry).
Constraint:
, or .
- 4:
n – IntegerInput
-
On entry:
, the order of the matrix .
Constraint:
.
- 5:
ilo – IntegerInput
- 6:
ihi – IntegerInput
-
On entry: if the matrix
has been balanced by
nag_dgebal (f08nhc), then
ilo and
ihi must contain the values returned by that function. Otherwise,
ilo must be set to
and
ihi to
n.
Constraint:
and .
- 7:
h[] – doubleInput/Output
-
Note: the dimension,
dim, of the array
h
must be at least
.
Where
appears in this document, it refers to the array element
- when ;
- when .
On entry: the
by
upper Hessenberg matrix
, as returned by
nag_dgehrd (f08nec).
On exit: if
, the array contains no useful information.
If
,
h is overwritten by the upper
quasi-triangular
matrix
from the Schur decomposition (the Schur form) unless
NE_CONVERGENCE.
- 8:
pdh – IntegerInput
-
On entry: the stride separating row or column elements (depending on the value of
order) in the array
h.
Constraint:
.
- 9:
wr[] – doubleOutput
- 10:
wi[] – doubleOutput
Note: the dimension,
dim, of the arrays
wr and
wi
must be at least
.
On exit: the real and imaginary parts, respectively, of the computed eigenvalues, unless
NE_CONVERGENCE (in which case see
Section 6). Complex conjugate pairs of eigenvalues appear consecutively with the eigenvalue having positive imaginary part first. The eigenvalues are stored in the same order as on the diagonal of the Schur form
(if computed); see
Section 8 for details.
- 11:
z[] – doubleInput/Output
-
Note: the dimension,
dim, of the array
z
must be at least
- when
or and
;
- when
or and
;
- when
.
The
th element of the matrix
is stored in
- when ;
- when .
On entry: if
,
z must contain the orthogonal matrix
from the reduction to Hessenberg form.
If
,
z need not be set.
On exit: if
or
,
z contains the orthogonal matrix of the required Schur vectors, unless
NE_CONVERGENCE.
If
,
z is not referenced.
- 12:
pdz – IntegerInput
-
On entry: the stride separating row or column elements (depending on the value of
order) in the array
z.
Constraints:
- if ,
- if or , ;
- if , ;
- if ,
- if or ,
;
- if ,
.
- 13:
fail – NagError *Input/Output
-
The NAG error argument (see
Section 3.6 in the Essential Introduction).
6 Error Indicators and Warnings
- NE_ALLOC_FAIL
Dynamic memory allocation failed.
- NE_BAD_PARAM
On entry, argument had an illegal value.
- NE_CONVERGENCE
The algorithm has failed to find all the eigenvalues after a total of iterations.
- NE_ENUM_INT_2
On entry, , and .
Constraint: if or , ;
if , .
On entry, , , .
Constraint: if or ,
;
if ,
.
- NE_INT
On entry, .
Constraint: .
On entry, .
Constraint: .
On entry, .
Constraint: .
- NE_INT_2
On entry, and .
Constraint: .
- NE_INT_3
On entry, , and .
Constraint: and .
- 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.
7 Accuracy
The computed Schur factorization is the exact factorization of a nearby matrix
, where
and
is the
machine precision.
If
is an exact eigenvalue, and
is the corresponding computed value, then
where
is a modestly increasing function of
, and
is the reciprocal condition number of
. The condition numbers
may be computed by calling
nag_dtrsna (f08qlc).
The total number of floating point operations depends on how rapidly the algorithm converges, but is typically about:
- if only eigenvalues are computed;
- if the Schur form is computed;
- if the full Schur factorization is computed.
The Schur form has the following structure (referred to as canonical Schur form).
If all the computed eigenvalues are real, is upper triangular, and the diagonal elements of are the eigenvalues; , for , and .
If some of the computed eigenvalues form complex conjugate pairs, then
has
by
diagonal blocks. Each diagonal block has the form
where
. The corresponding eigenvalues are
;
;
;
.
The complex analogue of this function is
nag_zhseqr (f08psc).
9 Example
This example computes all the eigenvalues and the Schur factorization of the upper Hessenberg matrix
, where
See also
Section 9 in nag_dorghr (f08nfc), which illustrates the use of this function to compute the Schur factorization of a general matrix.
9.1 Program Text
Program Text (f08pece.c)
9.2 Program Data
Program Data (f08pece.d)
9.3 Program Results
Program Results (f08pece.r)