Matrix Q Generation from QR Factorization#

UNGQR (UNitary matrix Generation after QR factorization) explicitly generates the unitary matrix Q from the QR factorization GEQRF. Recall that the QR factorization of a M x N matrix A is given by:

\[A = Q * R\]

where R is an (N x N) upper triangular matrix, and Q is an (M x N) unitary matrix with orthonormal columns, defined as the first N columns of a product of K Householder reflectors H of order M:

\[ \begin{align}\begin{aligned}Q &= H(0) * H(1) * . . . * H(K - 1),\\H(i) &= I - tau[i] * v * v^H\end{aligned}\end{align} \]

Function GEQRF does not explicitly form Q. The elements below the diagonal of A, i.e., the vectors v, with the array tau, represent the matrix Q as a product of a sequence of K Householder reflectors.

Function ungqr explicitly forms Q as a (M x N) unitary matrix, where M >= N >= K is required.

cuSolverDx ungqr device functions are (see Execution Methods):

__device__ void execute(data_type* A, const data_type* tau);
// with runtime leading dimensions
__device__ void execute(data_type* A, const unsigned int lda, const data_type* tau);

A is a batched M x N matrix coming from the output of GEQRF, with leading dimension lda >= M if A is in column-major layout, or lda >= N if A is row-major. The upper triangular part of A contains the vectors v that define the elementary Householder reflectors.

Array tau is an input array of size K for each batch, coming from the output of GEQRF.

After the function returns, A is overwritten with the matrix Q.

The functions support:

  1. A being either column- or row-major memory layout, see Arrangement Operator.

  2. Matrix A dimension M >= N >= K is required.