LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
dgeqrt.f
Go to the documentation of this file.
00001 *> \brief \b DGEQRT
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *> \htmlonly
00009 *> Download DGEQRT + dependencies 
00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dgeqrt.f"> 
00011 *> [TGZ]</a> 
00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dgeqrt.f"> 
00013 *> [ZIP]</a> 
00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dgeqrt.f"> 
00015 *> [TXT]</a>
00016 *> \endhtmlonly 
00017 *
00018 *  Definition:
00019 *  ===========
00020 *
00021 *       SUBROUTINE DGEQRT( M, N, NB, A, LDA, T, LDT, WORK, INFO )
00022 * 
00023 *       .. Scalar Arguments ..
00024 *       INTEGER INFO, LDA, LDT, M, N, NB
00025 *       ..
00026 *       .. Array Arguments ..
00027 *       DOUBLE PRECISION A( LDA, * ), T( LDT, * ), WORK( * )
00028 *       ..
00029 *  
00030 *
00031 *> \par Purpose:
00032 *  =============
00033 *>
00034 *> \verbatim
00035 *>
00036 *> DGEQRT computes a blocked QR factorization of a real M-by-N matrix A
00037 *> using the compact WY representation of Q.  
00038 *> \endverbatim
00039 *
00040 *  Arguments:
00041 *  ==========
00042 *
00043 *> \param[in] M
00044 *> \verbatim
00045 *>          M is INTEGER
00046 *>          The number of rows of the matrix A.  M >= 0.
00047 *> \endverbatim
00048 *>
00049 *> \param[in] N
00050 *> \verbatim
00051 *>          N is INTEGER
00052 *>          The number of columns of the matrix A.  N >= 0.
00053 *> \endverbatim
00054 *>
00055 *> \param[in] NB
00056 *> \verbatim
00057 *>          NB is INTEGER
00058 *>          The block size to be used in the blocked QR.  MIN(M,N) >= NB >= 1.
00059 *> \endverbatim
00060 *>
00061 *> \param[in,out] A
00062 *> \verbatim
00063 *>          A is DOUBLE PRECISION array, dimension (LDA,N)
00064 *>          On entry, the M-by-N matrix A.
00065 *>          On exit, the elements on and above the diagonal of the array
00066 *>          contain the min(M,N)-by-N upper trapezoidal matrix R (R is
00067 *>          upper triangular if M >= N); the elements below the diagonal
00068 *>          are the columns of V.
00069 *> \endverbatim
00070 *>
00071 *> \param[in] LDA
00072 *> \verbatim
00073 *>          LDA is INTEGER
00074 *>          The leading dimension of the array A.  LDA >= max(1,M).
00075 *> \endverbatim
00076 *>
00077 *> \param[out] T
00078 *> \verbatim
00079 *>          T is DOUBLE PRECISION array, dimension (LDT,MIN(M,N))
00080 *>          The upper triangular block reflectors stored in compact form
00081 *>          as a sequence of upper triangular blocks.  See below
00082 *>          for further details.
00083 *> \endverbatim
00084 *>
00085 *> \param[in] LDT
00086 *> \verbatim
00087 *>          LDT is INTEGER
00088 *>          The leading dimension of the array T.  LDT >= NB.
00089 *> \endverbatim
00090 *>
00091 *> \param[out] WORK
00092 *> \verbatim
00093 *>          WORK is DOUBLE PRECISION array, dimension (NB*N)
00094 *> \endverbatim
00095 *>
00096 *> \param[out] INFO
00097 *> \verbatim
00098 *>          INFO is INTEGER
00099 *>          = 0:  successful exit
00100 *>          < 0:  if INFO = -i, the i-th argument had an illegal value
00101 *> \endverbatim
00102 *
00103 *  Authors:
00104 *  ========
00105 *
00106 *> \author Univ. of Tennessee 
00107 *> \author Univ. of California Berkeley 
00108 *> \author Univ. of Colorado Denver 
00109 *> \author NAG Ltd. 
00110 *
00111 *> \date November 2011
00112 *
00113 *> \ingroup doubleGEcomputational
00114 *
00115 *> \par Further Details:
00116 *  =====================
00117 *>
00118 *> \verbatim
00119 *>
00120 *>  The matrix V stores the elementary reflectors H(i) in the i-th column
00121 *>  below the diagonal. For example, if M=5 and N=3, the matrix V is
00122 *>
00123 *>               V = (  1       )
00124 *>                   ( v1  1    )
00125 *>                   ( v1 v2  1 )
00126 *>                   ( v1 v2 v3 )
00127 *>                   ( v1 v2 v3 )
00128 *>
00129 *>  where the vi's represent the vectors which define H(i), which are returned
00130 *>  in the matrix A.  The 1's along the diagonal of V are not stored in A.
00131 *>
00132 *>  Let K=MIN(M,N).  The number of blocks is B = ceiling(K/NB), where each
00133 *>  block is of order NB except for the last block, which is of order 
00134 *>  IB = K - (B-1)*NB.  For each of the B blocks, a upper triangular block
00135 *>  reflector factor is computed: T1, T2, ..., TB.  The NB-by-NB (and IB-by-IB 
00136 *>  for the last block) T's are stored in the NB-by-N matrix T as
00137 *>
00138 *>               T = (T1 T2 ... TB).
00139 *> \endverbatim
00140 *>
00141 *  =====================================================================
00142       SUBROUTINE DGEQRT( M, N, NB, A, LDA, T, LDT, WORK, INFO )
00143 *
00144 *  -- LAPACK computational routine (version 3.4.0) --
00145 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00146 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00147 *     November 2011
00148 *
00149 *     .. Scalar Arguments ..
00150       INTEGER INFO, LDA, LDT, M, N, NB
00151 *     ..
00152 *     .. Array Arguments ..
00153       DOUBLE PRECISION A( LDA, * ), T( LDT, * ), WORK( * )
00154 *     ..
00155 *
00156 * =====================================================================
00157 *
00158 *     ..
00159 *     .. Local Scalars ..
00160       INTEGER    I, IB, IINFO, K
00161       LOGICAL    USE_RECURSIVE_QR
00162       PARAMETER( USE_RECURSIVE_QR=.TRUE. )
00163 *     ..
00164 *     .. External Subroutines ..
00165       EXTERNAL   DGEQRT2, DGEQRT3, DLARFB, XERBLA
00166 *     ..
00167 *     .. Executable Statements ..
00168 *
00169 *     Test the input arguments
00170 *
00171       INFO = 0
00172       IF( M.LT.0 ) THEN
00173          INFO = -1
00174       ELSE IF( N.LT.0 ) THEN
00175          INFO = -2
00176       ELSE IF( NB.LT.1 .OR. NB.GT.MIN(M,N) ) THEN
00177          INFO = -3
00178       ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
00179          INFO = -5
00180       ELSE IF( LDT.LT.NB ) THEN
00181          INFO = -7
00182       END IF
00183       IF( INFO.NE.0 ) THEN
00184          CALL XERBLA( 'DGEQRT', -INFO )
00185          RETURN
00186       END IF
00187 *
00188 *     Quick return if possible
00189 *
00190       K = MIN( M, N )
00191       IF( K.EQ.0 ) RETURN
00192 *
00193 *     Blocked loop of length K
00194 *
00195       DO I = 1, K,  NB
00196          IB = MIN( K-I+1, NB )
00197 *     
00198 *     Compute the QR factorization of the current block A(I:M,I:I+IB-1)
00199 *
00200          IF( USE_RECURSIVE_QR ) THEN
00201             CALL DGEQRT3( M-I+1, IB, A(I,I), LDA, T(1,I), LDT, IINFO )
00202          ELSE
00203             CALL DGEQRT2( M-I+1, IB, A(I,I), LDA, T(1,I), LDT, IINFO )
00204          END IF
00205          IF( I+IB.LE.N ) THEN
00206 *
00207 *     Update by applying H**T to A(I:M,I+IB:N) from the left
00208 *
00209             CALL DLARFB( 'L', 'T', 'F', 'C', M-I+1, N-I-IB+1, IB,
00210      $                   A( I, I ), LDA, T( 1, I ), LDT, 
00211      $                   A( I, I+IB ), LDA, WORK , N-I-IB+1 )
00212          END IF
00213       END DO
00214       RETURN
00215 *     
00216 *     End of DGEQRT
00217 *
00218       END
 All Files Functions