![]() |
LAPACK
3.4.1
LAPACK: Linear Algebra PACKage
|
00001 *> \brief \b ZGEQRT2 00002 * 00003 * =========== DOCUMENTATION =========== 00004 * 00005 * Online html documentation available at 00006 * http://www.netlib.org/lapack/explore-html/ 00007 * 00008 *> \htmlonly 00009 *> Download ZGEQRT2 + dependencies 00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zgeqrt2.f"> 00011 *> [TGZ]</a> 00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zgeqrt2.f"> 00013 *> [ZIP]</a> 00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zgeqrt2.f"> 00015 *> [TXT]</a> 00016 *> \endhtmlonly 00017 * 00018 * Definition: 00019 * =========== 00020 * 00021 * SUBROUTINE ZGEQRT2( M, N, A, LDA, T, LDT, INFO ) 00022 * 00023 * .. Scalar Arguments .. 00024 * INTEGER INFO, LDA, LDT, M, N 00025 * .. 00026 * .. Array Arguments .. 00027 * COMPLEX*16 A( LDA, * ), T( LDT, * ) 00028 * .. 00029 * 00030 * 00031 *> \par Purpose: 00032 * ============= 00033 *> 00034 *> \verbatim 00035 *> 00036 *> ZGEQRT2 computes a QR factorization of a complex 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 >= N. 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 COMPLEX*16 array, dimension (LDA,N) 00058 *> On entry, the complex M-by-N matrix A. On exit, the elements on and 00059 *> above the diagonal contain the N-by-N upper triangular matrix R; the 00060 *> elements below the diagonal are the columns of V. See below for 00061 *> further details. 00062 *> \endverbatim 00063 *> 00064 *> \param[in] LDA 00065 *> \verbatim 00066 *> LDA is INTEGER 00067 *> The leading dimension of the array A. LDA >= max(1,M). 00068 *> \endverbatim 00069 *> 00070 *> \param[out] T 00071 *> \verbatim 00072 *> T is COMPLEX*16 array, dimension (LDT,N) 00073 *> The N-by-N upper triangular factor of the block reflector. 00074 *> The elements on and above the diagonal contain the block 00075 *> reflector T; the elements below the diagonal are not used. 00076 *> See below for further details. 00077 *> \endverbatim 00078 *> 00079 *> \param[in] LDT 00080 *> \verbatim 00081 *> LDT is INTEGER 00082 *> The leading dimension of the array T. LDT >= max(1,N). 00083 *> \endverbatim 00084 *> 00085 *> \param[out] INFO 00086 *> \verbatim 00087 *> INFO is INTEGER 00088 *> = 0: successful exit 00089 *> < 0: if INFO = -i, the i-th argument had an illegal value 00090 *> \endverbatim 00091 * 00092 * Authors: 00093 * ======== 00094 * 00095 *> \author Univ. of Tennessee 00096 *> \author Univ. of California Berkeley 00097 *> \author Univ. of Colorado Denver 00098 *> \author NAG Ltd. 00099 * 00100 *> \date November 2011 00101 * 00102 *> \ingroup complex16GEcomputational 00103 * 00104 *> \par Further Details: 00105 * ===================== 00106 *> 00107 *> \verbatim 00108 *> 00109 *> The matrix V stores the elementary reflectors H(i) in the i-th column 00110 *> below the diagonal. For example, if M=5 and N=3, the matrix V is 00111 *> 00112 *> V = ( 1 ) 00113 *> ( v1 1 ) 00114 *> ( v1 v2 1 ) 00115 *> ( v1 v2 v3 ) 00116 *> ( v1 v2 v3 ) 00117 *> 00118 *> where the vi's represent the vectors which define H(i), which are returned 00119 *> in the matrix A. The 1's along the diagonal of V are not stored in A. The 00120 *> block reflector H is then given by 00121 *> 00122 *> H = I - V * T * V**H 00123 *> 00124 *> where V**H is the conjugate transpose of V. 00125 *> \endverbatim 00126 *> 00127 * ===================================================================== 00128 SUBROUTINE ZGEQRT2( M, N, A, LDA, T, LDT, INFO ) 00129 * 00130 * -- LAPACK computational routine (version 3.4.0) -- 00131 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00132 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00133 * November 2011 00134 * 00135 * .. Scalar Arguments .. 00136 INTEGER INFO, LDA, LDT, M, N 00137 * .. 00138 * .. Array Arguments .. 00139 COMPLEX*16 A( LDA, * ), T( LDT, * ) 00140 * .. 00141 * 00142 * ===================================================================== 00143 * 00144 * .. Parameters .. 00145 COMPLEX*16 ONE, ZERO 00146 PARAMETER( ONE = (1.0D+00,0.0D+00), ZERO = (0.0D+00,0.0D+00) ) 00147 * .. 00148 * .. Local Scalars .. 00149 INTEGER I, K 00150 COMPLEX*16 AII, ALPHA 00151 * .. 00152 * .. External Subroutines .. 00153 EXTERNAL ZLARFG, ZGEMV, ZGERC, ZTRMV, XERBLA 00154 * .. 00155 * .. Executable Statements .. 00156 * 00157 * Test the input arguments 00158 * 00159 INFO = 0 00160 IF( M.LT.0 ) THEN 00161 INFO = -1 00162 ELSE IF( N.LT.0 ) THEN 00163 INFO = -2 00164 ELSE IF( LDA.LT.MAX( 1, M ) ) THEN 00165 INFO = -4 00166 ELSE IF( LDT.LT.MAX( 1, N ) ) THEN 00167 INFO = -6 00168 END IF 00169 IF( INFO.NE.0 ) THEN 00170 CALL XERBLA( 'ZGEQRT2', -INFO ) 00171 RETURN 00172 END IF 00173 * 00174 K = MIN( M, N ) 00175 * 00176 DO I = 1, K 00177 * 00178 * Generate elem. refl. H(i) to annihilate A(i+1:m,i), tau(I) -> T(I,1) 00179 * 00180 CALL ZLARFG( M-I+1, A( I, I ), A( MIN( I+1, M ), I ), 1, 00181 $ T( I, 1 ) ) 00182 IF( I.LT.N ) THEN 00183 * 00184 * Apply H(i) to A(I:M,I+1:N) from the left 00185 * 00186 AII = A( I, I ) 00187 A( I, I ) = ONE 00188 * 00189 * W(1:N-I) := A(I:M,I+1:N)^H * A(I:M,I) [W = T(:,N)] 00190 * 00191 CALL ZGEMV( 'C',M-I+1, N-I, ONE, A( I, I+1 ), LDA, 00192 $ A( I, I ), 1, ZERO, T( 1, N ), 1 ) 00193 * 00194 * A(I:M,I+1:N) = A(I:m,I+1:N) + alpha*A(I:M,I)*W(1:N-1)^H 00195 * 00196 ALPHA = -CONJG(T( I, 1 )) 00197 CALL ZGERC( M-I+1, N-I, ALPHA, A( I, I ), 1, 00198 $ T( 1, N ), 1, A( I, I+1 ), LDA ) 00199 A( I, I ) = AII 00200 END IF 00201 END DO 00202 * 00203 DO I = 2, N 00204 AII = A( I, I ) 00205 A( I, I ) = ONE 00206 * 00207 * T(1:I-1,I) := alpha * A(I:M,1:I-1)**H * A(I:M,I) 00208 * 00209 ALPHA = -T( I, 1 ) 00210 CALL ZGEMV( 'C', M-I+1, I-1, ALPHA, A( I, 1 ), LDA, 00211 $ A( I, I ), 1, ZERO, T( 1, I ), 1 ) 00212 A( I, I ) = AII 00213 * 00214 * T(1:I-1,I) := T(1:I-1,1:I-1) * T(1:I-1,I) 00215 * 00216 CALL ZTRMV( 'U', 'N', 'N', I-1, T, LDT, T( 1, I ), 1 ) 00217 * 00218 * T(I,I) = tau(I) 00219 * 00220 T( I, I ) = T( I, 1 ) 00221 T( I, 1) = ZERO 00222 END DO 00223 00224 * 00225 * End of ZGEQRT2 00226 * 00227 END