# ?lahqr

Computes the eigenvalues and Schur factorization of an upper Hessenberg matrix, using the double-shift/single-shift QR algorithm.

## Syntax

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

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

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

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

## Description

This routine is an auxiliary routine called by ?hseqr to update the eigenvalues and Schur decomposition already computed by ?hseqr, by dealing with the Hessenberg submatrix in rows and columns ilo to ihi.

## Input Parameters

wantt

  LOGICAL.

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

  If `wantt = .FALSE.`, eigenvalues only 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 matrix H (`n ≥ 0`).

ilo, ihi

  INTEGER.

  It is assumed that h is already upper quasi-triangular in rows and columns ihi+1:n, and that `h(ilo,ilo-1) = 0` (unless `ilo = 1`). The routine ?lahqr works primarily with the Hessenberg submatrix in rows and columns ilo to ihi, but applies transformations to all of h if `wantt = .TRUE.`.

  Constraints:

  `1 ≤ ilo ≤ max(1,ihi); ihi ≤ n`.

h, z

  REAL for slahqr

  DOUBLE PRECISION for dlahqr

  COMPLEX for clahqr

  COMPLEX*16 for zlahqr.

  Arrays:

  h(ldh,*) contains the upper Hessenberg matrix h.

  The second dimension of h must be at least `max(1, n)`.

  z(ldz,*)

  If `wantz = .TRUE.`, then, on entry, z must contain the current matrix z of transformations accumulated by ?hseqr.

  If `wantz = .FALSE.`, then z is not referenced. The second dimension of z must be at least `max(1, n)`.

ldh

  INTEGER. The first dimension of h; at least `max(1, n)`.

ldz

  INTEGER. The first dimension of z; at least `max(1, n)`.

iloz, ihiz

  INTEGER. Specify the rows of z to which transformations must be applied if `wantz = .TRUE.`.

  `1 ≤ iloz ≤ ilo`; `ihi ≤ ihiz ≤ n`.

## Output Parameters

h

  On exit, if info= 0 and wantt = .TRUE., then,

  - for slahqr/dlahqr, h is upper quasi-triangular in rows and columns ilo:ihi with any 2-by-2 diagonal blocks in standard form.

  - for clahqr/zlahqr, h is upper triangular in rows and columns ilo:ihi.

If info= 0 and wantt = .FALSE., the contents of h are unspecified on exit. If info is positive, see description of info for the output state of h.

wr, wi

  REAL for slahqr

  DOUBLE PRECISION for dlahqr

  Arrays, DIMENSION at least `max(1, n)` each. Used with real flavors only. The real and imaginary parts, respectively, of the computed eigenvalues ilo to ihi are stored in the corresponding elements of wr and wi. 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 = .TRUE.`, 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, `wi(i) = sqrt(h(i+1,i)*h(i,i+1))` and `wi(i+1) = -wi(i)`.

w

  COMPLEX for clahqr

  COMPLEX*16 for zlahqr.

  Array, DIMENSION at least `max(1, n)`. Used with complex flavors only. The computed eigenvalues ilo to ihi are stored in the corresponding elements of w.

  If `wantt = .TRUE.`, 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)`.

z

  If `wantz = .TRUE.`, then, on exit z has been updated; transformations are applied only to the submatrix z(iloz:ihiz, ilo:ihi).

info

  INTEGER.

  If `info = 0`, the execution is successful.

  With `info > 0`,

  - if info = i, ?lahqr failed to compute all the eigenvalues ilo to ihi in a total of 30 iterations per eigenvalue; elements `i+1:ihi` of wr and wi (for slahqr/dlahqr) or w (for clahqr/zlahqr) contain those eigenvalues which have been successfully computed.

  - if wantt is .FALSE., then on exit the remaining unconverged eigenvalues are the eigenvalues of the upper Hessenberg matrix rows and columns ilo thorugh info of the final output value of h.

  - if wantt is .TRUE., then on exit
    (initial value of h)*u = u*(final value of h), `(*)`
    where u is an orthognal matrix. The final value of h is upper Hessenberg and triangular in rows and columns `info+1` through ihi.

  - if wantz is .TRUE., then on exit
    (final value of z) = (initial value of z)* u,
    where u is an orthognal matrix in `(*)` regardless of the value of wantt.

Parent topic: Auxiliary Routines