LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
stzrqf.f
Go to the documentation of this file.
00001 *> \brief \b STZRQF
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *> \htmlonly
00009 *> Download STZRQF + dependencies 
00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/stzrqf.f"> 
00011 *> [TGZ]</a> 
00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/stzrqf.f"> 
00013 *> [ZIP]</a> 
00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/stzrqf.f"> 
00015 *> [TXT]</a>
00016 *> \endhtmlonly 
00017 *
00018 *  Definition:
00019 *  ===========
00020 *
00021 *       SUBROUTINE STZRQF( M, N, A, LDA, TAU, INFO )
00022 * 
00023 *       .. Scalar Arguments ..
00024 *       INTEGER            INFO, LDA, M, N
00025 *       ..
00026 *       .. Array Arguments ..
00027 *       REAL               A( LDA, * ), TAU( * )
00028 *       ..
00029 *  
00030 *
00031 *> \par Purpose:
00032 *  =============
00033 *>
00034 *> \verbatim
00035 *>
00036 *> This routine is deprecated and has been replaced by routine STZRZF.
00037 *>
00038 *> STZRQF reduces the M-by-N ( M<=N ) real upper trapezoidal matrix A
00039 *> to upper triangular form by means of orthogonal transformations.
00040 *>
00041 *> The upper trapezoidal matrix A is factored as
00042 *>
00043 *>    A = ( R  0 ) * Z,
00044 *>
00045 *> where Z is an N-by-N orthogonal matrix and R is an M-by-M upper
00046 *> triangular matrix.
00047 *> \endverbatim
00048 *
00049 *  Arguments:
00050 *  ==========
00051 *
00052 *> \param[in] M
00053 *> \verbatim
00054 *>          M is INTEGER
00055 *>          The number of rows of the matrix A.  M >= 0.
00056 *> \endverbatim
00057 *>
00058 *> \param[in] N
00059 *> \verbatim
00060 *>          N is INTEGER
00061 *>          The number of columns of the matrix A.  N >= M.
00062 *> \endverbatim
00063 *>
00064 *> \param[in,out] A
00065 *> \verbatim
00066 *>          A is REAL array, dimension (LDA,N)
00067 *>          On entry, the leading M-by-N upper trapezoidal part of the
00068 *>          array A must contain the matrix to be factorized.
00069 *>          On exit, the leading M-by-M upper triangular part of A
00070 *>          contains the upper triangular matrix R, and elements M+1 to
00071 *>          N of the first M rows of A, with the array TAU, represent the
00072 *>          orthogonal matrix Z as a product of M elementary reflectors.
00073 *> \endverbatim
00074 *>
00075 *> \param[in] LDA
00076 *> \verbatim
00077 *>          LDA is INTEGER
00078 *>          The leading dimension of the array A.  LDA >= max(1,M).
00079 *> \endverbatim
00080 *>
00081 *> \param[out] TAU
00082 *> \verbatim
00083 *>          TAU is REAL array, dimension (M)
00084 *>          The scalar factors of the elementary reflectors.
00085 *> \endverbatim
00086 *>
00087 *> \param[out] INFO
00088 *> \verbatim
00089 *>          INFO is INTEGER
00090 *>          = 0:  successful exit
00091 *>          < 0:  if INFO = -i, the i-th argument had an illegal value
00092 *> \endverbatim
00093 *
00094 *  Authors:
00095 *  ========
00096 *
00097 *> \author Univ. of Tennessee 
00098 *> \author Univ. of California Berkeley 
00099 *> \author Univ. of Colorado Denver 
00100 *> \author NAG Ltd. 
00101 *
00102 *> \date November 2011
00103 *
00104 *> \ingroup realOTHERcomputational
00105 *
00106 *> \par Further Details:
00107 *  =====================
00108 *>
00109 *> \verbatim
00110 *>
00111 *>  The factorization is obtained by Householder's method.  The kth
00112 *>  transformation matrix, Z( k ), which is used to introduce zeros into
00113 *>  the ( m - k + 1 )th row of A, is given in the form
00114 *>
00115 *>     Z( k ) = ( I     0   ),
00116 *>              ( 0  T( k ) )
00117 *>
00118 *>  where
00119 *>
00120 *>     T( k ) = I - tau*u( k )*u( k )**T,   u( k ) = (   1    ),
00121 *>                                                   (   0    )
00122 *>                                                   ( z( k ) )
00123 *>
00124 *>  tau is a scalar and z( k ) is an ( n - m ) element vector.
00125 *>  tau and z( k ) are chosen to annihilate the elements of the kth row
00126 *>  of X.
00127 *>
00128 *>  The scalar tau is returned in the kth element of TAU and the vector
00129 *>  u( k ) in the kth row of A, such that the elements of z( k ) are
00130 *>  in  a( k, m + 1 ), ..., a( k, n ). The elements of R are returned in
00131 *>  the upper triangular part of A.
00132 *>
00133 *>  Z is given by
00134 *>
00135 *>     Z =  Z( 1 ) * Z( 2 ) * ... * Z( m ).
00136 *> \endverbatim
00137 *>
00138 *  =====================================================================
00139       SUBROUTINE STZRQF( M, N, A, LDA, TAU, INFO )
00140 *
00141 *  -- LAPACK computational routine (version 3.4.0) --
00142 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00143 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00144 *     November 2011
00145 *
00146 *     .. Scalar Arguments ..
00147       INTEGER            INFO, LDA, M, N
00148 *     ..
00149 *     .. Array Arguments ..
00150       REAL               A( LDA, * ), TAU( * )
00151 *     ..
00152 *
00153 *  =====================================================================
00154 *
00155 *     .. Parameters ..
00156       REAL               ONE, ZERO
00157       PARAMETER          ( ONE = 1.0E+0, ZERO = 0.0E+0 )
00158 *     ..
00159 *     .. Local Scalars ..
00160       INTEGER            I, K, M1
00161 *     ..
00162 *     .. Intrinsic Functions ..
00163       INTRINSIC          MAX, MIN
00164 *     ..
00165 *     .. External Subroutines ..
00166       EXTERNAL           SAXPY, SCOPY, SGEMV, SGER, SLARFG, XERBLA
00167 *     ..
00168 *     .. Executable Statements ..
00169 *
00170 *     Test the input parameters.
00171 *
00172       INFO = 0
00173       IF( M.LT.0 ) THEN
00174          INFO = -1
00175       ELSE IF( N.LT.M ) THEN
00176          INFO = -2
00177       ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
00178          INFO = -4
00179       END IF
00180       IF( INFO.NE.0 ) THEN
00181          CALL XERBLA( 'STZRQF', -INFO )
00182          RETURN
00183       END IF
00184 *
00185 *     Perform the factorization.
00186 *
00187       IF( M.EQ.0 )
00188      $   RETURN
00189       IF( M.EQ.N ) THEN
00190          DO 10 I = 1, N
00191             TAU( I ) = ZERO
00192    10    CONTINUE
00193       ELSE
00194          M1 = MIN( M+1, N )
00195          DO 20 K = M, 1, -1
00196 *
00197 *           Use a Householder reflection to zero the kth row of A.
00198 *           First set up the reflection.
00199 *
00200             CALL SLARFG( N-M+1, A( K, K ), A( K, M1 ), LDA, TAU( K ) )
00201 *
00202             IF( ( TAU( K ).NE.ZERO ) .AND. ( K.GT.1 ) ) THEN
00203 *
00204 *              We now perform the operation  A := A*P( k ).
00205 *
00206 *              Use the first ( k - 1 ) elements of TAU to store  a( k ),
00207 *              where  a( k ) consists of the first ( k - 1 ) elements of
00208 *              the  kth column  of  A.  Also  let  B  denote  the  first
00209 *              ( k - 1 ) rows of the last ( n - m ) columns of A.
00210 *
00211                CALL SCOPY( K-1, A( 1, K ), 1, TAU, 1 )
00212 *
00213 *              Form   w = a( k ) + B*z( k )  in TAU.
00214 *
00215                CALL SGEMV( 'No transpose', K-1, N-M, ONE, A( 1, M1 ),
00216      $                     LDA, A( K, M1 ), LDA, ONE, TAU, 1 )
00217 *
00218 *              Now form  a( k ) := a( k ) - tau*w
00219 *              and       B      := B      - tau*w*z( k )**T.
00220 *
00221                CALL SAXPY( K-1, -TAU( K ), TAU, 1, A( 1, K ), 1 )
00222                CALL SGER( K-1, N-M, -TAU( K ), TAU, 1, A( K, M1 ), LDA,
00223      $                    A( 1, M1 ), LDA )
00224             END IF
00225    20    CONTINUE
00226       END IF
00227 *
00228       RETURN
00229 *
00230 *     End of STZRQF
00231 *
00232       END
 All Files Functions