**Purpose**

To perform the QR factorization ( U ) = Q*( R ), where U = ( U1 U2 ), R = ( R1 R2 ), ( x' ) ( 0 ) ( 0 T ) ( 0 R3 ) where U and R are (m+n)-by-(m+n) upper triangular matrices, x is an m+n element vector, U1 is m-by-m, T is n-by-n, stored separately, and Q is an (m+n+1)-by-(m+n+1) orthogonal matrix. The matrix ( U1 U2 ) must be supplied in the m-by-(m+n) upper trapezoidal part of the array A and this is overwritten by the corresponding part ( R1 R2 ) of R. The remaining upper triangular part of R, R3, is overwritten on the array T. The transformations performed are also applied to the (m+n+1)-by-p matrix ( B' C' d )' (' denotes transposition), where B, C, and d' are m-by-p, n-by-p, and 1-by-p matrices, respectively.

SUBROUTINE MB04OW( M, N, P, A, LDA, T, LDT, X, INCX, B, LDB, $ C, LDC, D, INCD ) C .. Scalar Arguments .. INTEGER INCD, INCX, LDA, LDB, LDC, LDT, M, N, P C .. Array Arguments .. DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*), D(*), T(LDT,*), $ X(*)

**Input/Output Parameters**

M (input) INTEGER The number of rows of the matrix ( U1 U2 ). M >= 0. N (input) INTEGER The order of the matrix T. N >= 0. P (input) INTEGER The number of columns of the matrices B and C. P >= 0. A (input/output) DOUBLE PRECISION array, dimension (LDA,N) On entry, the leading M-by-(M+N) upper trapezoidal part of this array must contain the upper trapezoidal matrix ( U1 U2 ). On exit, the leading M-by-(M+N) upper trapezoidal part of this array contains the upper trapezoidal matrix ( R1 R2 ). The strict lower triangle of A is not referenced. LDA INTEGER The leading dimension of the array A. LDA >= max(1,M). T (input/output) DOUBLE PRECISION array, dimension (LDT,N) On entry, the leading N-by-N upper triangular part of this array must contain the upper triangular matrix T. On exit, the leading N-by-N upper triangular part of this array contains the upper triangular matrix R3. The strict lower triangle of T is not referenced. LDT INTEGER The leading dimension of the array T. LDT >= max(1,N). X (input/output) DOUBLE PRECISION array, dimension (1+(M+N-1)*INCX), if M+N > 0, or dimension (0), if M+N = 0. On entry, the incremented array X must contain the vector x. On exit, the content of X is changed. INCX (input) INTEGER Specifies the increment for the elements of X. INCX > 0. B (input/output) DOUBLE PRECISION array, dimension (LDB,P) On entry, the leading M-by-P part of this array must contain the matrix B. On exit, the leading M-by-P part of this array contains the transformed matrix B. If M = 0 or P = 0, this array is not referenced. LDB INTEGER The leading dimension of the array B. LDB >= max(1,M), if P > 0; LDB >= 1, if P = 0. C (input/output) DOUBLE PRECISION array, dimension (LDC,P) On entry, the leading N-by-P part of this array must contain the matrix C. On exit, the leading N-by-P part of this array contains the transformed matrix C. If N = 0 or P = 0, this array is not referenced. LDC INTEGER The leading dimension of the array C. LDC >= max(1,N), if P > 0; LDC >= 1, if P = 0. D (input/output) DOUBLE PRECISION array, dimension (1+(P-1)*INCD), if P > 0, or dimension (0), if P = 0. On entry, the incremented array D must contain the vector d. On exit, this incremented array contains the transformed vector d. If P = 0, this array is not referenced. INCD (input) INTEGER Specifies the increment for the elements of D. INCD > 0.

Let q = m+n. The matrix Q is formed as a sequence of plane rotations in planes (1, q+1), (2, q+1), ..., (q, q+1), the rotation in the (j, q+1)th plane, Q(j), being chosen to annihilate the jth element of x.

The algorithm requires 0((M+N)*(M+N+P)) operations and is backward stable.

For P = 0, this routine produces the same result as SLICOT Library routine MB04OX, but matrix T may not be stored in the array A.

**Program Text**

None

None

None