![]() |
LAPACK
3.4.1
LAPACK: Linear Algebra PACKage
|
00001 *> \brief \b DGEQR2 00002 * 00003 * =========== DOCUMENTATION =========== 00004 * 00005 * Online html documentation available at 00006 * http://www.netlib.org/lapack/explore-html/ 00007 * 00008 *> \htmlonly 00009 *> Download DGEQR2 + dependencies 00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dgeqr2.f"> 00011 *> [TGZ]</a> 00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dgeqr2.f"> 00013 *> [ZIP]</a> 00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dgeqr2.f"> 00015 *> [TXT]</a> 00016 *> \endhtmlonly 00017 * 00018 * Definition: 00019 * =========== 00020 * 00021 * SUBROUTINE DGEQR2( M, N, A, LDA, TAU, WORK, INFO ) 00022 * 00023 * .. Scalar Arguments .. 00024 * INTEGER INFO, LDA, M, N 00025 * .. 00026 * .. Array Arguments .. 00027 * DOUBLE PRECISION A( LDA, * ), TAU( * ), WORK( * ) 00028 * .. 00029 * 00030 * 00031 *> \par Purpose: 00032 * ============= 00033 *> 00034 *> \verbatim 00035 *> 00036 *> DGEQR2 computes a QR factorization of a real m by n matrix A: 00037 *> A = Q * R. 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,out] A 00056 *> \verbatim 00057 *> A is DOUBLE PRECISION array, dimension (LDA,N) 00058 *> On entry, the m by n matrix A. 00059 *> On exit, the elements on and above the diagonal of the array 00060 *> contain the min(m,n) by n upper trapezoidal matrix R (R is 00061 *> upper triangular if m >= n); the elements below the diagonal, 00062 *> with the array TAU, represent the orthogonal matrix Q as a 00063 *> product of elementary reflectors (see Further Details). 00064 *> \endverbatim 00065 *> 00066 *> \param[in] LDA 00067 *> \verbatim 00068 *> LDA is INTEGER 00069 *> The leading dimension of the array A. LDA >= max(1,M). 00070 *> \endverbatim 00071 *> 00072 *> \param[out] TAU 00073 *> \verbatim 00074 *> TAU is DOUBLE PRECISION array, dimension (min(M,N)) 00075 *> The scalar factors of the elementary reflectors (see Further 00076 *> Details). 00077 *> \endverbatim 00078 *> 00079 *> \param[out] WORK 00080 *> \verbatim 00081 *> WORK is DOUBLE PRECISION array, dimension (N) 00082 *> \endverbatim 00083 *> 00084 *> \param[out] INFO 00085 *> \verbatim 00086 *> INFO is INTEGER 00087 *> = 0: successful exit 00088 *> < 0: if INFO = -i, the i-th argument had an illegal value 00089 *> \endverbatim 00090 * 00091 * Authors: 00092 * ======== 00093 * 00094 *> \author Univ. of Tennessee 00095 *> \author Univ. of California Berkeley 00096 *> \author Univ. of Colorado Denver 00097 *> \author NAG Ltd. 00098 * 00099 *> \date November 2011 00100 * 00101 *> \ingroup doubleGEcomputational 00102 * 00103 *> \par Further Details: 00104 * ===================== 00105 *> 00106 *> \verbatim 00107 *> 00108 *> The matrix Q is represented as a product of elementary reflectors 00109 *> 00110 *> Q = H(1) H(2) . . . H(k), where k = min(m,n). 00111 *> 00112 *> Each H(i) has the form 00113 *> 00114 *> H(i) = I - tau * v * v**T 00115 *> 00116 *> where tau is a real scalar, and v is a real vector with 00117 *> v(1:i-1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in A(i+1:m,i), 00118 *> and tau in TAU(i). 00119 *> \endverbatim 00120 *> 00121 * ===================================================================== 00122 SUBROUTINE DGEQR2( M, N, A, LDA, TAU, WORK, INFO ) 00123 * 00124 * -- LAPACK computational routine (version 3.4.0) -- 00125 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00126 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00127 * November 2011 00128 * 00129 * .. Scalar Arguments .. 00130 INTEGER INFO, LDA, M, N 00131 * .. 00132 * .. Array Arguments .. 00133 DOUBLE PRECISION A( LDA, * ), TAU( * ), WORK( * ) 00134 * .. 00135 * 00136 * ===================================================================== 00137 * 00138 * .. Parameters .. 00139 DOUBLE PRECISION ONE 00140 PARAMETER ( ONE = 1.0D+0 ) 00141 * .. 00142 * .. Local Scalars .. 00143 INTEGER I, K 00144 DOUBLE PRECISION AII 00145 * .. 00146 * .. External Subroutines .. 00147 EXTERNAL DLARF, DLARFG, XERBLA 00148 * .. 00149 * .. Intrinsic Functions .. 00150 INTRINSIC MAX, MIN 00151 * .. 00152 * .. Executable Statements .. 00153 * 00154 * Test the input arguments 00155 * 00156 INFO = 0 00157 IF( M.LT.0 ) THEN 00158 INFO = -1 00159 ELSE IF( N.LT.0 ) THEN 00160 INFO = -2 00161 ELSE IF( LDA.LT.MAX( 1, M ) ) THEN 00162 INFO = -4 00163 END IF 00164 IF( INFO.NE.0 ) THEN 00165 CALL XERBLA( 'DGEQR2', -INFO ) 00166 RETURN 00167 END IF 00168 * 00169 K = MIN( M, N ) 00170 * 00171 DO 10 I = 1, K 00172 * 00173 * Generate elementary reflector H(i) to annihilate A(i+1:m,i) 00174 * 00175 CALL DLARFG( M-I+1, A( I, I ), A( MIN( I+1, M ), I ), 1, 00176 $ TAU( I ) ) 00177 IF( I.LT.N ) THEN 00178 * 00179 * Apply H(i) to A(i:m,i+1:n) from the left 00180 * 00181 AII = A( I, I ) 00182 A( I, I ) = ONE 00183 CALL DLARF( 'Left', M-I+1, N-I, A( I, I ), 1, TAU( I ), 00184 $ A( I, I+1 ), LDA, WORK ) 00185 A( I, I ) = AII 00186 END IF 00187 10 CONTINUE 00188 RETURN 00189 * 00190 * End of DGEQR2 00191 * 00192 END