001:       SUBROUTINE STZRQF( M, N, A, LDA, TAU, INFO )
002: *
003: *  -- LAPACK routine (version 3.2) --
004: *     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
005: *     November 2006
006: *
007: *     .. Scalar Arguments ..
008:       INTEGER            INFO, LDA, M, N
009: *     ..
010: *     .. Array Arguments ..
011:       REAL               A( LDA, * ), TAU( * )
012: *     ..
013: *
014: *  Purpose
015: *  =======
016: *
017: *  This routine is deprecated and has been replaced by routine STZRZF.
018: *
019: *  STZRQF reduces the M-by-N ( M<=N ) real upper trapezoidal matrix A
020: *  to upper triangular form by means of orthogonal transformations.
021: *
022: *  The upper trapezoidal matrix A is factored as
023: *
024: *     A = ( R  0 ) * Z,
025: *
026: *  where Z is an N-by-N orthogonal matrix and R is an M-by-M upper
027: *  triangular matrix.
028: *
029: *  Arguments
030: *  =========
031: *
032: *  M       (input) INTEGER
033: *          The number of rows of the matrix A.  M >= 0.
034: *
035: *  N       (input) INTEGER
036: *          The number of columns of the matrix A.  N >= M.
037: *
038: *  A       (input/output) REAL array, dimension (LDA,N)
039: *          On entry, the leading M-by-N upper trapezoidal part of the
040: *          array A must contain the matrix to be factorized.
041: *          On exit, the leading M-by-M upper triangular part of A
042: *          contains the upper triangular matrix R, and elements M+1 to
043: *          N of the first M rows of A, with the array TAU, represent the
044: *          orthogonal matrix Z as a product of M elementary reflectors.
045: *
046: *  LDA     (input) INTEGER
047: *          The leading dimension of the array A.  LDA >= max(1,M).
048: *
049: *  TAU     (output) REAL array, dimension (M)
050: *          The scalar factors of the elementary reflectors.
051: *
052: *  INFO    (output) INTEGER
053: *          = 0:  successful exit
054: *          < 0:  if INFO = -i, the i-th argument had an illegal value
055: *
056: *  Further Details
057: *  ===============
058: *
059: *  The factorization is obtained by Householder's method.  The kth
060: *  transformation matrix, Z( k ), which is used to introduce zeros into
061: *  the ( m - k + 1 )th row of A, is given in the form
062: *
063: *     Z( k ) = ( I     0   ),
064: *              ( 0  T( k ) )
065: *
066: *  where
067: *
068: *     T( k ) = I - tau*u( k )*u( k )',   u( k ) = (   1    ),
069: *                                                 (   0    )
070: *                                                 ( z( k ) )
071: *
072: *  tau is a scalar and z( k ) is an ( n - m ) element vector.
073: *  tau and z( k ) are chosen to annihilate the elements of the kth row
074: *  of X.
075: *
076: *  The scalar tau is returned in the kth element of TAU and the vector
077: *  u( k ) in the kth row of A, such that the elements of z( k ) are
078: *  in  a( k, m + 1 ), ..., a( k, n ). The elements of R are returned in
079: *  the upper triangular part of A.
080: *
081: *  Z is given by
082: *
083: *     Z =  Z( 1 ) * Z( 2 ) * ... * Z( m ).
084: *
085: *  =====================================================================
086: *
087: *     .. Parameters ..
088:       REAL               ONE, ZERO
089:       PARAMETER          ( ONE = 1.0E+0, ZERO = 0.0E+0 )
090: *     ..
091: *     .. Local Scalars ..
092:       INTEGER            I, K, M1
093: *     ..
094: *     .. Intrinsic Functions ..
095:       INTRINSIC          MAX, MIN
096: *     ..
097: *     .. External Subroutines ..
098:       EXTERNAL           SAXPY, SCOPY, SGEMV, SGER, SLARFP, XERBLA
099: *     ..
100: *     .. Executable Statements ..
101: *
102: *     Test the input parameters.
103: *
104:       INFO = 0
105:       IF( M.LT.0 ) THEN
106:          INFO = -1
107:       ELSE IF( N.LT.M ) THEN
108:          INFO = -2
109:       ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
110:          INFO = -4
111:       END IF
112:       IF( INFO.NE.0 ) THEN
113:          CALL XERBLA( 'STZRQF', -INFO )
114:          RETURN
115:       END IF
116: *
117: *     Perform the factorization.
118: *
119:       IF( M.EQ.0 )
120:      $   RETURN
121:       IF( M.EQ.N ) THEN
122:          DO 10 I = 1, N
123:             TAU( I ) = ZERO
124:    10    CONTINUE
125:       ELSE
126:          M1 = MIN( M+1, N )
127:          DO 20 K = M, 1, -1
128: *
129: *           Use a Householder reflection to zero the kth row of A.
130: *           First set up the reflection.
131: *
132:             CALL SLARFP( N-M+1, A( K, K ), A( K, M1 ), LDA, TAU( K ) )
133: *
134:             IF( ( TAU( K ).NE.ZERO ) .AND. ( K.GT.1 ) ) THEN
135: *
136: *              We now perform the operation  A := A*P( k ).
137: *
138: *              Use the first ( k - 1 ) elements of TAU to store  a( k ),
139: *              where  a( k ) consists of the first ( k - 1 ) elements of
140: *              the  kth column  of  A.  Also  let  B  denote  the  first
141: *              ( k - 1 ) rows of the last ( n - m ) columns of A.
142: *
143:                CALL SCOPY( K-1, A( 1, K ), 1, TAU, 1 )
144: *
145: *              Form   w = a( k ) + B*z( k )  in TAU.
146: *
147:                CALL SGEMV( 'No transpose', K-1, N-M, ONE, A( 1, M1 ),
148:      $                     LDA, A( K, M1 ), LDA, ONE, TAU, 1 )
149: *
150: *              Now form  a( k ) := a( k ) - tau*w
151: *              and       B      := B      - tau*w*z( k )'.
152: *
153:                CALL SAXPY( K-1, -TAU( K ), TAU, 1, A( 1, K ), 1 )
154:                CALL SGER( K-1, N-M, -TAU( K ), TAU, 1, A( K, M1 ), LDA,
155:      $                    A( 1, M1 ), LDA )
156:             END IF
157:    20    CONTINUE
158:       END IF
159: *
160:       RETURN
161: *
162: *     End of STZRQF
163: *
164:       END
165: