# ?org2r/?ung2r

Generates all or part of the orthogonal/unitary matrix Q from a QR factorization determined by ?geqrf (unblocked algorithm).

## Syntax

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

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

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

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

## Description

The routine ?org2r/?ung2r generates an m-by-n real/complex matrix Q with orthonormal columns, which is defined as the first n columns of a product of k elementary reflectors of order m

`Q = H(1)*H(2)*...*H(k)`

as returned by ?geqrf.

## Input Parameters

m

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

n

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

k

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

a

  REAL for sorg2r

  DOUBLE PRECISION for dorg2r

  COMPLEX for cung2r

  COMPLEX*16 for zung2r.

  Array, DIMENSION (lda, n).

  On entry, the i-th column must contain the vector which defines the elementary reflector H(i), for i = 1,2,..., k, as returned by ?geqrf in the first k columns of its array argument a.

lda

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

tau

  REAL for sorg2r

  DOUBLE PRECISION for dorg2r

  COMPLEX for cung2r

  COMPLEX*16 for zung2r.

  Array, DIMENSION (k).

  tau(i) must contain the scalar factor of the elementary reflector H(i), as returned by ?geqrf.

work

  REAL for sorg2r

  DOUBLE PRECISION for dorg2r

  COMPLEX for cung2r

  COMPLEX*16 for zung2r.

  Workspace array, DIMENSION (n).

## 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