# ?laqr0

Computes the eigenvalues of a Hessenberg matrix, and optionally the marixes from the Schur decomposition.

## Syntax

call slaqr0( wantt, wantz, n, ilo, ihi, h, ldh, wr, wi, iloz, ihiz, z, ldz, work, lwork, info )

call dlaqr0( wantt, wantz, n, ilo, ihi, h, ldh, wr, wi, iloz, ihiz, z, ldz, work, lwork, info )

call claqr0( wantt, wantz, n, ilo, ihi, h, ldh, w, iloz, ihiz, z, ldz, work, lwork, info )

call zlaqr0( wantt, wantz, n, ilo, ihi, h, ldh, w, iloz, ihiz, z, ldz, work, lwork, info )

## Description

This routine computes the eigenvalues of a Hessenberg matrix H, and, optionally, the matrices T and Z from the Schur decomposition `H=Z*T*ZH`, where T is an upper quasi-triangular/triangular matrix (the Schur form), and Z is the orthogonal/unitary matrix of Schur vectors.

Optionally Z may be postmultiplied into an input orthogonal/unitary matrix Q so that this routine can give the Schur factorization of a matrix A which has been reduced to the Hessenberg form H by the orthogonal/unitary matrix Q: `A = Q*H*QH = (QZ)*H*(QZ)H`.

## Input Parameters

wantt

  LOGICAL.

  If `wantt = .TRUE.`, the full Schur form T is required;

  If `wantt = .FALSE.`, only eigenvalues are required.

wantz

  LOGICAL.

  If `wantz = .TRUE.`, the matrix of Schur vectors Z is required;

  If `wantz = .FALSE.`, Schur vectors are not required.

n

  INTEGER. The order of the Hessenberg matrix H. `(n ≥ 0)`.

ilo, ihi

  INTEGER.

  It is assumed that H is already upper triangular in rows and columns `1:ilo-1` and `ihi+1:n`, and if `ilo > 1` then `H(ilo, ilo-1) = 0`.

  ilo and ihi are normally set by a previous call to cgebal, and then passed to cgehrd when the matrix output by cgebal is reduced to Hessenberg form. Otherwise, ilo and ihi should be set to `1` and n, respectively.

  If `n > 0`, then `1 ≤ ilo ≤ ihi ≤ n`.

  If `n=0`, then `ilo=1` and `ihi=0`

h

  REAL for slaqr0

  DOUBLE PRECISION for dlaqr0

  COMPLEX for claqr0

  COMPLEX*16 for zlaqr0.

  Array, DIMENSION (ldh, n), contains the upper Hessenberg matrix H.

ldh

  INTEGER. The leading dimension of the array h. `ldh ≥ max(1, n)`.

iloz, ihiz

  INTEGER. Specify the rows of Z to which transformations must be applied if wantz is `.TRUE., 1 ≤ iloz ≤ ilo; ihi ≤ ihiz ≤ n`.

z

  REAL for slaqr0

  DOUBLE PRECISION for dlaqr0

  COMPLEX for claqr0

  COMPLEX*16 for zlaqr0.

  Array, DIMENSION (ldz, ihi), contains the matrix Z if wantz is .TRUE.. If wantz is .FALSE., z is not referenced.

ldz

  INTEGER. The leading dimension of the array z.

  If wantz is .TRUE., then `ldz ≥ max(1, ihiz)`. Otherwise, `ldz ≥ 1`.

work

  REAL for slaqr0

  DOUBLE PRECISION for dlaqr0

  COMPLEX for claqr0

  COMPLEX*16 for zlaqr0.

  Workspace array with dimension lwork.

lwork

  INTEGER. The dimension of the array work.

  `lwork ≥ max(1,n)` is sufficient, but for the optimal performance a greater workspace may be required, typically as large as `6*n`.

  It is recommended to use the worlspace query to determine the optimal workspace size. If `lwork=-1,`then the routine performs a workspace query: it estimates the optimal workspace size for the given values of the input parameters n, ilo, and ihi. The estimate is returned in `work(1)`. No error messages related to the lwork is issued by xerbla. Neither H nor Z are accessed.

## Output Parameters

h

  If `info=0` , and wantt is .TRUE., then h contains the upper quasi-triangular/triangular matrix T from the Schur decomposition (the Schur form).

  If `info=0` , and wantt is .FALSE., then the contents of h are unspecified on exit.

  (The output values of h when `info > 0` are given under the description of the info parameter below.)

  The routine may explicitly set `h(i,j)` for `i>j` and `j=1,2,...ilo-1` or`j=ihi+1, ihi+2,...n`.

`work(1)`

  On exit `work(1)` contains the minimum value of lwork required for optimum performance.

w

  COMPLEX for claqr0

  COMPLEX*16 for zlaqr0.

  Arrays, DIMENSION(n). The computed eigenvalues of h(ilo:ihi, ilo:ihi) are stored in w(ilo:ihi). If wantt is .TRUE., then the eigenvalues are stored in the same order as on the diagonal of the Schur form returned in h, with `w(i) = h(i,i)`.

wr, wi

  REAL for slaqr0

  DOUBLE PRECISION for dlaqr0

  Arrays, DIMENSION(ihi) each. The real and imaginary parts, respectively, of the computed eigenvalues of h(ilo:ihi, ilo:ihi) are stored in the wr(ilo:ihi) and wi(ilo:ihi). If two eigenvalues are computed as a complex conjugate pair, they are stored in consecutive elements of wr and wi, say the i-th and (i+1)-th, with wi(i)> 0 and wi(i+1) < 0. If wantt is .TRUE. , then the eigenvalues are stored in the same order as on the diagonal of the Schur form returned in h, with `wr(i) = h(i,i)`, and if `h(i:i+1,i:i+1)`is a 2-by-2 diagonal block, then `wi(i)=sqrt(-h(i+1,i)*h(i,i+1))`.

z

  If wantz is .TRUE., then z(ilo:ihi, iloz:ihiz) is replaced by z(ilo:ihi, iloz:ihiz)*U, where U is the orthogonal/unitary Schur factor of h(ilo:ihi, ilo:ihi).

  If wantz is .FALSE., z is not referenced.

  (The output values of z when `info > 0` are given under the description of the info parameter below.)

info

  INTEGER.

  `= 0`: the execution is successful.

  `> 0`: if `info = i`, then the routine failed to compute all the eigenvalues. Elements `1:ilo-1` and `i+1:n` of wr and wi contain those eigenvalues which have been successfully computed.

  `> 0`: if wantt is .FALSE., then the remaining unconverged eigenvalues are the eigenvalues of the upper Hessenberg matrix rows and columns ilo through info of the final output value of h.

  `> 0`: if wantt is .TRUE., then `(`initial value of `h)*U = U*(`final value of `h,` where U is an orthogonal/unitary matrix. The final value of h is upper Hessenberg and quasi-triangular/triangular in rows and columns `info+1` through ihi.

  `> 0`: if wantz is .TRUE., then `(`final value of `z(ilo:ihi, iloz:ihiz))=(`initial value of `z(ilo:ihi, iloz:ihiz)*U`, where U is the orthogonal/unitary matrix in the previous expression (regardless of the value of wantt).

  `> 0`: if wantz is .FALSE., then z is not accessed.

Parent topic: Auxiliary Routines