?hseqr
?hseqr
Computes all eigenvalues and (optionally) the Schur factorization of a matrix reduced to Hessenberg form.
Syntax
lapack_int LAPACKE_shseqr
(
int
matrix_layout
,
char
job
,
char
compz
,
lapack_int
n
,
lapack_int
ilo
,
lapack_int
ihi
,
float*
h
,
lapack_int
ldh
,
float*
wr
,
float*
wi
,
float*
z
,
lapack_int
ldz
);
lapack_int LAPACKE_dhseqr
(
int
matrix_layout
,
char
job
,
char
compz
,
lapack_int
n
,
lapack_int
ilo
,
lapack_int
ihi
,
double*
h
,
lapack_int
ldh
,
double*
wr
,
double*
wi
,
double*
z
,
lapack_int
ldz
);
lapack_int LAPACKE_chseqr
(
int
matrix_layout
,
char
job
,
char
compz
,
lapack_int
n
,
lapack_int
ilo
,
lapack_int
ihi
,
lapack_complex_float*
h
,
lapack_int
ldh
,
lapack_complex_float*
w
,
lapack_complex_float*
z
,
lapack_int
ldz
);
lapack_int LAPACKE_zhseqr
(
int
matrix_layout
,
char
job
,
char
compz
,
lapack_int
n
,
lapack_int
ilo
,
lapack_int
ihi
,
lapack_complex_double*
h
,
lapack_int
ldh
,
lapack_complex_double*
w
,
lapack_complex_double*
z
,
lapack_int
ldz
);
Include Files
- mkl.h
Description
The routine computes all the eigenvalues, and optionally the Schur factorization, of an upper Hessenberg matrix , where .
H
: H
= Z
*T
*Z
H
T
is an upper triangular (or, for real flavors, quasi-triangular) matrix (the Schur form of H
), and Z
is the unitary or orthogonal matrix whose columns are the Schur vectors z
i
You can also use this routine to compute the Schur factorization of a general matrix
A
which has been reduced to upper Hessenberg form H
:A
= Q
*H
*Q
H
Q
is unitary (orthogonal for real flavors); A
= (QZ
)*T
*(QZ
)H
You can also call gebal to balance the original matrix before reducing it to Hessenberg form by
?hseqr
, so that the Hessenberg matrix H
will have the
structure:
where
H
11
and H
33
are upper triangular.If so, only the central diagonal block
H
22
(in rows and columns ilo
to ihi
) needs to be further reduced to Schur form (the blocks H
12
and H
23
are also affected). Therefore the values of ilo
and ihi
can be supplied to ?hseqr
directly. Also, after calling this routine you must call gebak to permute the Schur vectors of the balanced matrix to those of the original matrix.If or
?gebal
has not been called, however, then ilo
must be set to 1 and ihi
to n
. Note that if the Schur factorization of A
is required, ?gebal
must not be called with job
= 'S'
'B'
, because the balancing transformation is not unitary (for real flavors, it is not orthogonal).?hseqr
uses a multishift form of the upper Hessenberg QR
algorithm. The Schur vectors are normalized so that ||||
, but are determined only to within a complex factor of absolute value 1 (for the real flavors, to within a factor z
i
2
= 1±
1).Input Parameters
- job
- Must be'E'or'S'.If, then eigenvalues only are required.job='E'If, then the Schur formjob='S'Tis required.
- compz
- Must be'N'or'I'or'V'.Ifcompz='N', then no Schur vectors are computed (and the arrayzis not referenced).Ifcompz='I', then the Schur vectors ofHare computed (and the arrayzis initialized by the routine).Ifcompz='V', then the Schur vectors ofAare computed (and the arrayzmust contain the matrixQon entry).
- n
- The order of the matrixH().n≥0
- ilo,ihi
- IfAhas been balanced by?gebal, theniloandihimust contain the values returned by?gebal. Otherwise,ilomust be set to 1 andihiton.
- h,z
- Arrays:h(size max(1,) Theldh*n))n-by-nupper Hessenberg matrixH.z(size max(1,ldz*n))If, thencompz='V'zmust contain the matrixQfrom the reduction to Hessenberg form.If, thencompz='I'zneed not be set.If, thencompz='N'zis not referenced.
- ldh
- The leading dimension ofh; at least max(1,n).
- ldz
- The leading dimension ofz;If, thencompz='N'.ldz≥1Iforcompz='V''I', then.ldz≥max(1,n)
Output Parameters
- w
- Array, size at least max (1,n). Contains the computed eigenvalues, unlessinfo>0. The eigenvalues are stored in the same order as on the diagonal of the Schur formT(if computed).
- wr,wi
- Arrays, size at least max (1,n) each.Contain the real and imaginary parts, respectively, of the computed eigenvalues, unless. 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 forminfo> 0T(if computed).
- h
- Ifandinfo= 0,job= 'S'hcontains the upper quasi-triangular matrixTfrom the Schur decomposition (the Schur form).Ifandinfo= 0, the contents ofjob= 'E'hare unspecified on exit. (The output value ofhwhenis given under the description ofinfo> 0infobelow.)
- z
- Ifandcompz='V', theninfo= 0zcontains.Q*ZIfandcompz='I', theninfo= 0zcontains the unitary or orthogonal matrixZof the Schur vectors ofH.If, thencompz='N'zis not referenced.
Return Values
This function returns a value
info
.If , the execution is successful.
info
= 0If , the
info
= -i
i
-th parameter had an illegal value. If ,
info
= i
?hseqr
failed to compute all of the eigenvalues. Elements 1,2, ..., ilo
-1 and i
+1, i
+2, ..., n
of the eigenvalue arrays (wr
and wi
for real flavors and w
for complex flavors) contain the real and imaginary parts of those eigenvalues that have been successfully found.If , and , then on exit, the remaining unconverged eigenvalues are the eigenvalues of the upper Hessenberg matrix rows and columns
info
> 0job
= 'E'
ilo
through info
of the final output value of H
. If , and , then on exit (initial value of through
info
> 0job
= 'S'
H
)*U
= U
*(final value of H
), where U
is a unitary matrix. The final value of H
is upper Hessenberg and triangular in rows and columns info
+1ihi
.If , and , then on exit (final value of
info
> 0compz
= 'V'
Z
) = (initial value of Z
)*U
, where U
is the unitary matrix (regardless of the value of job
).If , and , then on exit (final value of
info
> 0compz
= 'I'
Z
) = U
, where U
is the unitary matrix (regardless of the value of job
).If , and , then
info
> 0compz
= 'N'
Z
is not accessed.Application Notes
The computed Schur factorization is the exact factorization of a nearby matrix , where
H
+ E
||
, and E
||2
< O
(ε
) ||H
||2
/s
i
ε
is the machine precision. If is an exact eigenvalue, and is the corresponding computed value, then , where is a modestly increasing function of is the reciprocal condition number of . The condition numbers may be computed by calling trsna.
λ
i
μ
i
| - |
λ
i
μ
i
≤
c
(n
)*ε
*||H
||2
/s
i
c
(n
)n
, and s
i
λ
i
s
i
The total number of floating-point operations depends on how rapidly the algorithm converges; typical numbers are as follows.
- If only eigenvalues are computed:
- 7n3for real flavors25n3for complex flavors.
- If the Schur form is computed:
- 10n3for real flavors35n3for complex flavors.
- If the full Schur factorization is computed:
- 20n3for real flavors70n3for complex flavors.