![]() |
LAPACK
3.4.1
LAPACK: Linear Algebra PACKage
|
00001 *> \brief \b ZGEQLF 00002 * 00003 * =========== DOCUMENTATION =========== 00004 * 00005 * Online html documentation available at 00006 * http://www.netlib.org/lapack/explore-html/ 00007 * 00008 *> \htmlonly 00009 *> Download ZGEQLF + dependencies 00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zgeqlf.f"> 00011 *> [TGZ]</a> 00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zgeqlf.f"> 00013 *> [ZIP]</a> 00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zgeqlf.f"> 00015 *> [TXT]</a> 00016 *> \endhtmlonly 00017 * 00018 * Definition: 00019 * =========== 00020 * 00021 * SUBROUTINE ZGEQLF( M, N, A, LDA, TAU, WORK, LWORK, INFO ) 00022 * 00023 * .. Scalar Arguments .. 00024 * INTEGER INFO, LDA, LWORK, M, N 00025 * .. 00026 * .. Array Arguments .. 00027 * COMPLEX*16 A( LDA, * ), TAU( * ), WORK( * ) 00028 * .. 00029 * 00030 * 00031 *> \par Purpose: 00032 * ============= 00033 *> 00034 *> \verbatim 00035 *> 00036 *> ZGEQLF computes a QL factorization of a complex M-by-N matrix A: 00037 *> A = Q * L. 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 COMPLEX*16 array, dimension (LDA,N) 00058 *> On entry, the M-by-N matrix A. 00059 *> On exit, 00060 *> if m >= n, the lower triangle of the subarray 00061 *> A(m-n+1:m,1:n) contains the N-by-N lower triangular matrix L; 00062 *> if m <= n, the elements on and below the (n-m)-th 00063 *> superdiagonal contain the M-by-N lower trapezoidal matrix L; 00064 *> the remaining elements, with the array TAU, represent the 00065 *> unitary matrix Q as a product of elementary reflectors 00066 *> (see Further Details). 00067 *> \endverbatim 00068 *> 00069 *> \param[in] LDA 00070 *> \verbatim 00071 *> LDA is INTEGER 00072 *> The leading dimension of the array A. LDA >= max(1,M). 00073 *> \endverbatim 00074 *> 00075 *> \param[out] TAU 00076 *> \verbatim 00077 *> TAU is COMPLEX*16 array, dimension (min(M,N)) 00078 *> The scalar factors of the elementary reflectors (see Further 00079 *> Details). 00080 *> \endverbatim 00081 *> 00082 *> \param[out] WORK 00083 *> \verbatim 00084 *> WORK is COMPLEX*16 array, dimension (MAX(1,LWORK)) 00085 *> On exit, if INFO = 0, WORK(1) returns the optimal LWORK. 00086 *> \endverbatim 00087 *> 00088 *> \param[in] LWORK 00089 *> \verbatim 00090 *> LWORK is INTEGER 00091 *> The dimension of the array WORK. LWORK >= max(1,N). 00092 *> For optimum performance LWORK >= N*NB, where NB is 00093 *> the optimal blocksize. 00094 *> 00095 *> If LWORK = -1, then a workspace query is assumed; the routine 00096 *> only calculates the optimal size of the WORK array, returns 00097 *> this value as the first entry of the WORK array, and no error 00098 *> message related to LWORK is issued by XERBLA. 00099 *> \endverbatim 00100 *> 00101 *> \param[out] INFO 00102 *> \verbatim 00103 *> INFO is INTEGER 00104 *> = 0: successful exit 00105 *> < 0: if INFO = -i, the i-th argument had an illegal value 00106 *> \endverbatim 00107 * 00108 * Authors: 00109 * ======== 00110 * 00111 *> \author Univ. of Tennessee 00112 *> \author Univ. of California Berkeley 00113 *> \author Univ. of Colorado Denver 00114 *> \author NAG Ltd. 00115 * 00116 *> \date November 2011 00117 * 00118 *> \ingroup complex16GEcomputational 00119 * 00120 *> \par Further Details: 00121 * ===================== 00122 *> 00123 *> \verbatim 00124 *> 00125 *> The matrix Q is represented as a product of elementary reflectors 00126 *> 00127 *> Q = H(k) . . . H(2) H(1), where k = min(m,n). 00128 *> 00129 *> Each H(i) has the form 00130 *> 00131 *> H(i) = I - tau * v * v**H 00132 *> 00133 *> where tau is a complex scalar, and v is a complex vector with 00134 *> v(m-k+i+1:m) = 0 and v(m-k+i) = 1; v(1:m-k+i-1) is stored on exit in 00135 *> A(1:m-k+i-1,n-k+i), and tau in TAU(i). 00136 *> \endverbatim 00137 *> 00138 * ===================================================================== 00139 SUBROUTINE ZGEQLF( M, N, A, LDA, TAU, WORK, LWORK, 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, LWORK, M, N 00148 * .. 00149 * .. Array Arguments .. 00150 COMPLEX*16 A( LDA, * ), TAU( * ), WORK( * ) 00151 * .. 00152 * 00153 * ===================================================================== 00154 * 00155 * .. Local Scalars .. 00156 LOGICAL LQUERY 00157 INTEGER I, IB, IINFO, IWS, K, KI, KK, LDWORK, LWKOPT, 00158 $ MU, NB, NBMIN, NU, NX 00159 * .. 00160 * .. External Subroutines .. 00161 EXTERNAL XERBLA, ZGEQL2, ZLARFB, ZLARFT 00162 * .. 00163 * .. Intrinsic Functions .. 00164 INTRINSIC MAX, MIN 00165 * .. 00166 * .. External Functions .. 00167 INTEGER ILAENV 00168 EXTERNAL ILAENV 00169 * .. 00170 * .. Executable Statements .. 00171 * 00172 * Test the input arguments 00173 * 00174 INFO = 0 00175 LQUERY = ( LWORK.EQ.-1 ) 00176 IF( M.LT.0 ) THEN 00177 INFO = -1 00178 ELSE IF( N.LT.0 ) THEN 00179 INFO = -2 00180 ELSE IF( LDA.LT.MAX( 1, M ) ) THEN 00181 INFO = -4 00182 END IF 00183 * 00184 IF( INFO.EQ.0 ) THEN 00185 K = MIN( M, N ) 00186 IF( K.EQ.0 ) THEN 00187 LWKOPT = 1 00188 ELSE 00189 NB = ILAENV( 1, 'ZGEQLF', ' ', M, N, -1, -1 ) 00190 LWKOPT = N*NB 00191 END IF 00192 WORK( 1 ) = LWKOPT 00193 * 00194 IF( LWORK.LT.MAX( 1, N ) .AND. .NOT.LQUERY ) THEN 00195 INFO = -7 00196 END IF 00197 END IF 00198 * 00199 IF( INFO.NE.0 ) THEN 00200 CALL XERBLA( 'ZGEQLF', -INFO ) 00201 RETURN 00202 ELSE IF( LQUERY ) THEN 00203 RETURN 00204 END IF 00205 * 00206 * Quick return if possible 00207 * 00208 IF( K.EQ.0 ) THEN 00209 RETURN 00210 END IF 00211 * 00212 NBMIN = 2 00213 NX = 1 00214 IWS = N 00215 IF( NB.GT.1 .AND. NB.LT.K ) THEN 00216 * 00217 * Determine when to cross over from blocked to unblocked code. 00218 * 00219 NX = MAX( 0, ILAENV( 3, 'ZGEQLF', ' ', M, N, -1, -1 ) ) 00220 IF( NX.LT.K ) THEN 00221 * 00222 * Determine if workspace is large enough for blocked code. 00223 * 00224 LDWORK = N 00225 IWS = LDWORK*NB 00226 IF( LWORK.LT.IWS ) THEN 00227 * 00228 * Not enough workspace to use optimal NB: reduce NB and 00229 * determine the minimum value of NB. 00230 * 00231 NB = LWORK / LDWORK 00232 NBMIN = MAX( 2, ILAENV( 2, 'ZGEQLF', ' ', M, N, -1, 00233 $ -1 ) ) 00234 END IF 00235 END IF 00236 END IF 00237 * 00238 IF( NB.GE.NBMIN .AND. NB.LT.K .AND. NX.LT.K ) THEN 00239 * 00240 * Use blocked code initially. 00241 * The last kk columns are handled by the block method. 00242 * 00243 KI = ( ( K-NX-1 ) / NB )*NB 00244 KK = MIN( K, KI+NB ) 00245 * 00246 DO 10 I = K - KK + KI + 1, K - KK + 1, -NB 00247 IB = MIN( K-I+1, NB ) 00248 * 00249 * Compute the QL factorization of the current block 00250 * A(1:m-k+i+ib-1,n-k+i:n-k+i+ib-1) 00251 * 00252 CALL ZGEQL2( M-K+I+IB-1, IB, A( 1, N-K+I ), LDA, TAU( I ), 00253 $ WORK, IINFO ) 00254 IF( N-K+I.GT.1 ) THEN 00255 * 00256 * Form the triangular factor of the block reflector 00257 * H = H(i+ib-1) . . . H(i+1) H(i) 00258 * 00259 CALL ZLARFT( 'Backward', 'Columnwise', M-K+I+IB-1, IB, 00260 $ A( 1, N-K+I ), LDA, TAU( I ), WORK, LDWORK ) 00261 * 00262 * Apply H**H to A(1:m-k+i+ib-1,1:n-k+i-1) from the left 00263 * 00264 CALL ZLARFB( 'Left', 'Conjugate transpose', 'Backward', 00265 $ 'Columnwise', M-K+I+IB-1, N-K+I-1, IB, 00266 $ A( 1, N-K+I ), LDA, WORK, LDWORK, A, LDA, 00267 $ WORK( IB+1 ), LDWORK ) 00268 END IF 00269 10 CONTINUE 00270 MU = M - K + I + NB - 1 00271 NU = N - K + I + NB - 1 00272 ELSE 00273 MU = M 00274 NU = N 00275 END IF 00276 * 00277 * Use unblocked code to factor the last or only block 00278 * 00279 IF( MU.GT.0 .AND. NU.GT.0 ) 00280 $ CALL ZGEQL2( MU, NU, A, LDA, TAU, WORK, IINFO ) 00281 * 00282 WORK( 1 ) = IWS 00283 RETURN 00284 * 00285 * End of ZGEQLF 00286 * 00287 END