On exit: the elements on and above the diagonal of the array contain the minn,m by m upper trapezoidal matrix R (R is upper triangular if n≥m); the elements below the diagonal, with the array TAUA, represent the orthogonal matrix Q as a product of minn,m elementary reflectors (see Section 3.3.6 in the F08 Chapter Introduction).

5: LDA – INTEGERInput

On entry: the first dimension of the array A as declared in the (sub)program from which F08ZEF (DGGQRF) is called.

Constraint:
LDA≥max1,N.

6: TAUA(minN,M) – REAL (KIND=nag_wp) arrayOutput

On exit: the scalar factors of the elementary reflectors which represent the orthogonal matrix Q.

On exit: if n≤p, the upper triangle of the subarray B1:n,p-n+1:p contains the n by n upper triangular matrix T12.

If n>p, the elements on and above the n-pth subdiagonal contain the n by p upper trapezoidal matrix T; the remaining elements, with the array TAUB, represent the orthogonal matrix Z as a product of elementary reflectors (see Section 3.3.6 in the F08 Chapter Introduction).

8: LDB – INTEGERInput

On entry: the first dimension of the array B as declared in the (sub)program from which F08ZEF (DGGQRF) is called.

Constraint:
LDB≥max1,N.

9: TAUB(minN,P) – REAL (KIND=nag_wp) arrayOutput

On exit: the scalar factors of the elementary reflectors which represent the orthogonal matrix Z.

10: WORK(max1,LWORK) – REAL (KIND=nag_wp) arrayWorkspace

On exit: if INFO=0, WORK1 contains the minimum value of LWORK required for optimal performance.

11: LWORK – INTEGERInput

On entry: the dimension of the array WORK as declared in the (sub)program from which F08ZEF (DGGQRF) is called.

If LWORK=-1, 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.

Suggested value:
for optimal performance, LWORK≥maxN,M,P×maxnb1,nb2,nb3, where nb1 is the optimal block size for the QR factorization of an n by m matrix, nb2 is the optimal block size for the RQ factorization of an n by p matrix, and nb3 is the optimal block size for a call of F08AGF (DORMQR).

The solution is obtained by first computing a generalized QR factorization of the matrix pair A,B. The example illustrates the general solution process, although the above data corresponds to a simple weighted least squares problem.

Note that the block size (NB) of 64 assumed in this example is not realistic for such a small problem, but should be suitable for large problems.