# ?ormhr

Multiplies an arbitrary real matrix C by the real orthogonal matrix Q determined by ?gehrd.

## Syntax

FORTRAN 77:

call sormhr(side, trans, m, n, ilo, ihi, a, lda, tau, c, ldc, work, lwork, info)

call dormhr(side, trans, m, n, ilo, ihi, a, lda, tau, c, ldc, work, lwork, info)

Fortran 95:

call ormhr(a, tau, c [,ilo] [,ihi] [,side] [,trans] [,info])

## Description

This routine multiplies a matrix C by the orthogonal matrix Q that has been determined by a preceding call to sgehrd/dgehrd. (The routine ?gehrd reduces a real general matrix A to upper Hessenberg form H by an orthogonal similarity transformation, `A = Q*H*QT`, and represents the matrix Q as a product of ihi-ilo elementary reflectors. Here ilo and ihi are values determined by sgebal/dgebal when balancing the matrix;if the matrix has not been balanced, `ilo = 1` and `ihi = n`.)

With ?ormhr, you can form one of the matrix products `Q*C`, `QT*C`, `C*Q`, or `C*QT`, overwriting the result on C (which may be any real rectangular matrix).

A common application of ?ormhr is to transform a matrix V of eigenvectors of H to the matrix QV of eigenvectors of A.

## Input Parameters

side

  CHARACTER*1. Must be 'L' or 'R'.

  If side = 'L', then the routine forms `Q*C` or `QT*C`.

  If side = 'R', then the routine forms `C*Q` or `C*QT`.

trans

  CHARACTER*1. Must be 'N' or 'T'.

  If trans = 'N' , then Q is applied to C.

  If trans = 'T', then QT is applied to C.

m

  INTEGER. The number of rows in C (`m ≥ 0`).

n

  INTEGER. The number of columns in C (`n ≥ 0`).

ilo, ihi

  INTEGER. These must be the same parameters ilo and ihi, respectively, as supplied to ?gehrd.

  If `m > 0` and `side = 'L'`, then `1 ≤ ilo ≤ ihi ≤ m`.

  If `m = 0` and `side = 'L'` , then `ilo = 1` and `ihi = 0`.

  If `n > 0` and `side = 'R'`, then `1 ≤ ilo ≤ ihi ≤ n`.

  If `n = 0` and `side = 'R'` , then `ilo = 1` and `ihi = 0`.

a, tau, c, work

  REAL for sormhr

  DOUBLE PRECISION for dormhr

  Arrays:

  a(lda,*) contains details of the vectors which define the elementary reflectors, as returned by ?gehrd.

  The second dimension of a must be at least max(1, m) if `side = 'L'` and at least max(1, n) if `side = 'R'`.

  tau(*) contains further details of the elementary reflectors, as returned by ?gehrd .

  The dimension of tau must be at least max (1, m-1)

  if `side = 'L'` and at least max (1, n-1) if `side = 'R'`.

  c(ldc,*) contains the m by n matrix C. The second dimension of c must be at least max(1, n).

  work is a workspace array, its dimension `max(1, lwork)`.
lda

  INTEGER. The first dimension of a; at least max(1, m) if `side = 'L'` and at least max (1, n) if `side = 'R'`.

ldc

  INTEGER. The first dimension of c; at least max(1, m).

lwork

  INTEGER. The size of the work array.

  If `side = 'L'`, lwork ≥ max(1, n).

  If `side = 'R'`, lwork ≥ max(1, m).

  If `lwork = -1`, then a workspace query is assumed; the routine only calculates the optimal size of the work array, returns this value as the first entry of the work array, and no error message related to lwork is issued by xerbla.

  See Application Notes for the suggested value of lwork.

## Output Parameters

c

  C is overwritten by product `Q*C`, `QT*C`, `C*Q`, or `C*QT` as specified by side and trans.

`work(1)`

  If `info = 0`, on exit `work(1)` contains the minimum value of lwork required for optimum performance. Use this lwork for subsequent runs.

info

  INTEGER.

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

  If `info = -i`, the i-th parameter had an illegal value.

## Fortran 95 Interface Notes

Routines in Fortran 95 interface have fewer arguments in the calling sequence than their FORTRAN 77 counterparts. For general conventions applied to skip redundant or restorable arguments, see Fortran 95 Interface Conventions.

Specific details for the routine ormhr interface are the following:

a

  Holds the matrix A of size (r,r).

  `r = m` if `side = 'L'`.

  `r = n` if `side = 'R'`.

tau

  Holds the vector of length (r-1).

c

  Holds the matrix C of size (m,n).

ilo

  Default value for this argument is `ilo = 1`.

ihi

  Default value for this argument is `ihi = n`.

side

  Must be 'L' or 'R'. The default value is 'L'.

trans

  Must be 'N' or 'T'. The default value is 'N'.

## Application Notes

For better performance, lwork should be at least n*blocksize if `side = 'L'` and at least m*blocksize if `side = 'R'`, where blocksize is a machine-dependent value (typically, 16 to 64) required for optimum performance of the blocked algorithm.

If you are in doubt how much workspace to supply, use a generous value of lwork for the first run or set `lwork = -1`.

If you choose the first option and set any of admissible lwork sizes, which is no less than the minimal value described, the routine completes the task, though probably not so fast as with a recommended workspace, and provides the recommended workspace in the first element of the corresponding array work on exit. Use this value (`work(1)`) for subsequent runs.

If you set `lwork = -1`, the routine returns immediately and provides the recommended workspace in the first element of the corresponding array (work). This operation is called a workspace query.

Note that if you set lwork to less than the minimal required value and not -1, the routine returns immediately with an error exit and does not provide any information on the recommended workspace.

The computed matrix Q differs from the exact result by a matrix E such that `||E||2 = O(ε)|*|C||2`, where ε is the machine precision.

The approximate number of floating-point operations is

`2n(ihi-ilo)2` if `side = 'L'`;

`2m(ihi-ilo)2` if `side = 'R'`.

The complex counterpart of this routine is ?unmhr.

Parent topic: Nonsymmetric Eigenvalue Problems