# ?orgr2/?ungr2

Generates all or part of the orthogonal/unitary matrix Q from an RQ factorization determined by ?gerqf (unblocked algorithm).

## Syntax

call sorgr2( m, n, k, a, lda, tau, work, info )

call dorgr2( m, n, k, a, lda, tau, work, info )

call cungr2( m, n, k, a, lda, tau, work, info )

call zungr2( m, n, k, a, lda, tau, work, info )

## Description

The routine ?orgr2/?ungr2 generates an m-by-n real matrix Q with orthonormal rows, which is defined as the last m rows of a product of k elementary reflectors of order n

`Q = H(1)*H(2)*...*H(k)` for real flavors, or `Q = (H(1))H*(H(2))H*...*(H(k))H` for complex flavors as returned by ?gerqf.

## Input Parameters

m

  INTEGER. The number of rows of the matrix Q. `m ≥ 0`.

n

  INTEGER. The number of columns of the matrix Q. `n ≥ m`

k

  INTEGER.

  The number of elementary reflectors whose product defines the matrix Q. `m ≥ k ≥ 0`.

a

  REAL for sorgr2

  DOUBLE PRECISION for dorgr2

  COMPLEX for cungr2

  COMPLEX*16 for zungr2.

  Array, DIMENSION (lda, n).

  On entry, the ( m- k+i)-th row must contain the vector which defines the elementary reflector H(i), for `i = 1,2,..., k`, as returned by ?gerqf in the last k rows of its array argument a.

lda

  INTEGER. The first dimension of the array a. `lda ≥ max(1,m)`.

tau

  REAL for sorgr2

  DOUBLE PRECISION for dorgr2

  COMPLEX for cungr2

  COMPLEX*16 for zungr2.

  Array, DIMENSION (k).tau(i) must contain the scalar factor of the elementary reflector H(i), as returned by ?gerqf.

work

  REAL for sorgr2

  DOUBLE PRECISION for dorgr2

  COMPLEX for cungr2

  COMPLEX*16 for zungr2.

  Workspace array, DIMENSION (m).

## Output Parameters

a

  On exit, the m-by-n matrix Q.

info

  INTEGER.

  = 0: successful exit

  < 0: if `info = -i`, the i-th argument has an illegal value

Parent topic: Auxiliary Routines