![]() |
LAPACK
3.4.1
LAPACK: Linear Algebra PACKage
|
00001 *> \brief \b ZUNMBR 00002 * 00003 * =========== DOCUMENTATION =========== 00004 * 00005 * Online html documentation available at 00006 * http://www.netlib.org/lapack/explore-html/ 00007 * 00008 *> \htmlonly 00009 *> Download ZUNMBR + dependencies 00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zunmbr.f"> 00011 *> [TGZ]</a> 00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zunmbr.f"> 00013 *> [ZIP]</a> 00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zunmbr.f"> 00015 *> [TXT]</a> 00016 *> \endhtmlonly 00017 * 00018 * Definition: 00019 * =========== 00020 * 00021 * SUBROUTINE ZUNMBR( VECT, SIDE, TRANS, M, N, K, A, LDA, TAU, C, 00022 * LDC, WORK, LWORK, INFO ) 00023 * 00024 * .. Scalar Arguments .. 00025 * CHARACTER SIDE, TRANS, VECT 00026 * INTEGER INFO, K, LDA, LDC, LWORK, M, N 00027 * .. 00028 * .. Array Arguments .. 00029 * COMPLEX*16 A( LDA, * ), C( LDC, * ), TAU( * ), WORK( * ) 00030 * .. 00031 * 00032 * 00033 *> \par Purpose: 00034 * ============= 00035 *> 00036 *> \verbatim 00037 *> 00038 *> If VECT = 'Q', ZUNMBR overwrites the general complex M-by-N matrix C 00039 *> with 00040 *> SIDE = 'L' SIDE = 'R' 00041 *> TRANS = 'N': Q * C C * Q 00042 *> TRANS = 'C': Q**H * C C * Q**H 00043 *> 00044 *> If VECT = 'P', ZUNMBR overwrites the general complex M-by-N matrix C 00045 *> with 00046 *> SIDE = 'L' SIDE = 'R' 00047 *> TRANS = 'N': P * C C * P 00048 *> TRANS = 'C': P**H * C C * P**H 00049 *> 00050 *> Here Q and P**H are the unitary matrices determined by ZGEBRD when 00051 *> reducing a complex matrix A to bidiagonal form: A = Q * B * P**H. Q 00052 *> and P**H are defined as products of elementary reflectors H(i) and 00053 *> G(i) respectively. 00054 *> 00055 *> Let nq = m if SIDE = 'L' and nq = n if SIDE = 'R'. Thus nq is the 00056 *> order of the unitary matrix Q or P**H that is applied. 00057 *> 00058 *> If VECT = 'Q', A is assumed to have been an NQ-by-K matrix: 00059 *> if nq >= k, Q = H(1) H(2) . . . H(k); 00060 *> if nq < k, Q = H(1) H(2) . . . H(nq-1). 00061 *> 00062 *> If VECT = 'P', A is assumed to have been a K-by-NQ matrix: 00063 *> if k < nq, P = G(1) G(2) . . . G(k); 00064 *> if k >= nq, P = G(1) G(2) . . . G(nq-1). 00065 *> \endverbatim 00066 * 00067 * Arguments: 00068 * ========== 00069 * 00070 *> \param[in] VECT 00071 *> \verbatim 00072 *> VECT is CHARACTER*1 00073 *> = 'Q': apply Q or Q**H; 00074 *> = 'P': apply P or P**H. 00075 *> \endverbatim 00076 *> 00077 *> \param[in] SIDE 00078 *> \verbatim 00079 *> SIDE is CHARACTER*1 00080 *> = 'L': apply Q, Q**H, P or P**H from the Left; 00081 *> = 'R': apply Q, Q**H, P or P**H from the Right. 00082 *> \endverbatim 00083 *> 00084 *> \param[in] TRANS 00085 *> \verbatim 00086 *> TRANS is CHARACTER*1 00087 *> = 'N': No transpose, apply Q or P; 00088 *> = 'C': Conjugate transpose, apply Q**H or P**H. 00089 *> \endverbatim 00090 *> 00091 *> \param[in] M 00092 *> \verbatim 00093 *> M is INTEGER 00094 *> The number of rows of the matrix C. M >= 0. 00095 *> \endverbatim 00096 *> 00097 *> \param[in] N 00098 *> \verbatim 00099 *> N is INTEGER 00100 *> The number of columns of the matrix C. N >= 0. 00101 *> \endverbatim 00102 *> 00103 *> \param[in] K 00104 *> \verbatim 00105 *> K is INTEGER 00106 *> If VECT = 'Q', the number of columns in the original 00107 *> matrix reduced by ZGEBRD. 00108 *> If VECT = 'P', the number of rows in the original 00109 *> matrix reduced by ZGEBRD. 00110 *> K >= 0. 00111 *> \endverbatim 00112 *> 00113 *> \param[in] A 00114 *> \verbatim 00115 *> A is COMPLEX*16 array, dimension 00116 *> (LDA,min(nq,K)) if VECT = 'Q' 00117 *> (LDA,nq) if VECT = 'P' 00118 *> The vectors which define the elementary reflectors H(i) and 00119 *> G(i), whose products determine the matrices Q and P, as 00120 *> returned by ZGEBRD. 00121 *> \endverbatim 00122 *> 00123 *> \param[in] LDA 00124 *> \verbatim 00125 *> LDA is INTEGER 00126 *> The leading dimension of the array A. 00127 *> If VECT = 'Q', LDA >= max(1,nq); 00128 *> if VECT = 'P', LDA >= max(1,min(nq,K)). 00129 *> \endverbatim 00130 *> 00131 *> \param[in] TAU 00132 *> \verbatim 00133 *> TAU is COMPLEX*16 array, dimension (min(nq,K)) 00134 *> TAU(i) must contain the scalar factor of the elementary 00135 *> reflector H(i) or G(i) which determines Q or P, as returned 00136 *> by ZGEBRD in the array argument TAUQ or TAUP. 00137 *> \endverbatim 00138 *> 00139 *> \param[in,out] C 00140 *> \verbatim 00141 *> C is COMPLEX*16 array, dimension (LDC,N) 00142 *> On entry, the M-by-N matrix C. 00143 *> On exit, C is overwritten by Q*C or Q**H*C or C*Q**H or C*Q 00144 *> or P*C or P**H*C or C*P or C*P**H. 00145 *> \endverbatim 00146 *> 00147 *> \param[in] LDC 00148 *> \verbatim 00149 *> LDC is INTEGER 00150 *> The leading dimension of the array C. LDC >= max(1,M). 00151 *> \endverbatim 00152 *> 00153 *> \param[out] WORK 00154 *> \verbatim 00155 *> WORK is COMPLEX*16 array, dimension (MAX(1,LWORK)) 00156 *> On exit, if INFO = 0, WORK(1) returns the optimal LWORK. 00157 *> \endverbatim 00158 *> 00159 *> \param[in] LWORK 00160 *> \verbatim 00161 *> LWORK is INTEGER 00162 *> The dimension of the array WORK. 00163 *> If SIDE = 'L', LWORK >= max(1,N); 00164 *> if SIDE = 'R', LWORK >= max(1,M); 00165 *> if N = 0 or M = 0, LWORK >= 1. 00166 *> For optimum performance LWORK >= max(1,N*NB) if SIDE = 'L', 00167 *> and LWORK >= max(1,M*NB) if SIDE = 'R', where NB is the 00168 *> optimal blocksize. (NB = 0 if M = 0 or N = 0.) 00169 *> 00170 *> If LWORK = -1, then a workspace query is assumed; the routine 00171 *> only calculates the optimal size of the WORK array, returns 00172 *> this value as the first entry of the WORK array, and no error 00173 *> message related to LWORK is issued by XERBLA. 00174 *> \endverbatim 00175 *> 00176 *> \param[out] INFO 00177 *> \verbatim 00178 *> INFO is INTEGER 00179 *> = 0: successful exit 00180 *> < 0: if INFO = -i, the i-th argument had an illegal value 00181 *> \endverbatim 00182 * 00183 * Authors: 00184 * ======== 00185 * 00186 *> \author Univ. of Tennessee 00187 *> \author Univ. of California Berkeley 00188 *> \author Univ. of Colorado Denver 00189 *> \author NAG Ltd. 00190 * 00191 *> \date November 2011 00192 * 00193 *> \ingroup complex16OTHERcomputational 00194 * 00195 * ===================================================================== 00196 SUBROUTINE ZUNMBR( VECT, SIDE, TRANS, M, N, K, A, LDA, TAU, C, 00197 $ LDC, WORK, LWORK, INFO ) 00198 * 00199 * -- LAPACK computational routine (version 3.4.0) -- 00200 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00201 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00202 * November 2011 00203 * 00204 * .. Scalar Arguments .. 00205 CHARACTER SIDE, TRANS, VECT 00206 INTEGER INFO, K, LDA, LDC, LWORK, M, N 00207 * .. 00208 * .. Array Arguments .. 00209 COMPLEX*16 A( LDA, * ), C( LDC, * ), TAU( * ), WORK( * ) 00210 * .. 00211 * 00212 * ===================================================================== 00213 * 00214 * .. Local Scalars .. 00215 LOGICAL APPLYQ, LEFT, LQUERY, NOTRAN 00216 CHARACTER TRANST 00217 INTEGER I1, I2, IINFO, LWKOPT, MI, NB, NI, NQ, NW 00218 * .. 00219 * .. External Functions .. 00220 LOGICAL LSAME 00221 INTEGER ILAENV 00222 EXTERNAL LSAME, ILAENV 00223 * .. 00224 * .. External Subroutines .. 00225 EXTERNAL XERBLA, ZUNMLQ, ZUNMQR 00226 * .. 00227 * .. Intrinsic Functions .. 00228 INTRINSIC MAX, MIN 00229 * .. 00230 * .. Executable Statements .. 00231 * 00232 * Test the input arguments 00233 * 00234 INFO = 0 00235 APPLYQ = LSAME( VECT, 'Q' ) 00236 LEFT = LSAME( SIDE, 'L' ) 00237 NOTRAN = LSAME( TRANS, 'N' ) 00238 LQUERY = ( LWORK.EQ.-1 ) 00239 * 00240 * NQ is the order of Q or P and NW is the minimum dimension of WORK 00241 * 00242 IF( LEFT ) THEN 00243 NQ = M 00244 NW = N 00245 ELSE 00246 NQ = N 00247 NW = M 00248 END IF 00249 IF( M.EQ.0 .OR. N.EQ.0 ) THEN 00250 NW = 0 00251 END IF 00252 IF( .NOT.APPLYQ .AND. .NOT.LSAME( VECT, 'P' ) ) THEN 00253 INFO = -1 00254 ELSE IF( .NOT.LEFT .AND. .NOT.LSAME( SIDE, 'R' ) ) THEN 00255 INFO = -2 00256 ELSE IF( .NOT.NOTRAN .AND. .NOT.LSAME( TRANS, 'C' ) ) THEN 00257 INFO = -3 00258 ELSE IF( M.LT.0 ) THEN 00259 INFO = -4 00260 ELSE IF( N.LT.0 ) THEN 00261 INFO = -5 00262 ELSE IF( K.LT.0 ) THEN 00263 INFO = -6 00264 ELSE IF( ( APPLYQ .AND. LDA.LT.MAX( 1, NQ ) ) .OR. 00265 $ ( .NOT.APPLYQ .AND. LDA.LT.MAX( 1, MIN( NQ, K ) ) ) ) 00266 $ THEN 00267 INFO = -8 00268 ELSE IF( LDC.LT.MAX( 1, M ) ) THEN 00269 INFO = -11 00270 ELSE IF( LWORK.LT.MAX( 1, NW ) .AND. .NOT.LQUERY ) THEN 00271 INFO = -13 00272 END IF 00273 * 00274 IF( INFO.EQ.0 ) THEN 00275 IF( NW.GT.0 ) THEN 00276 IF( APPLYQ ) THEN 00277 IF( LEFT ) THEN 00278 NB = ILAENV( 1, 'ZUNMQR', SIDE // TRANS, M-1, N, M-1, 00279 $ -1 ) 00280 ELSE 00281 NB = ILAENV( 1, 'ZUNMQR', SIDE // TRANS, M, N-1, N-1, 00282 $ -1 ) 00283 END IF 00284 ELSE 00285 IF( LEFT ) THEN 00286 NB = ILAENV( 1, 'ZUNMLQ', SIDE // TRANS, M-1, N, M-1, 00287 $ -1 ) 00288 ELSE 00289 NB = ILAENV( 1, 'ZUNMLQ', SIDE // TRANS, M, N-1, N-1, 00290 $ -1 ) 00291 END IF 00292 END IF 00293 LWKOPT = MAX( 1, NW*NB ) 00294 ELSE 00295 LWKOPT = 1 00296 END IF 00297 WORK( 1 ) = LWKOPT 00298 END IF 00299 * 00300 IF( INFO.NE.0 ) THEN 00301 CALL XERBLA( 'ZUNMBR', -INFO ) 00302 RETURN 00303 ELSE IF( LQUERY ) THEN 00304 RETURN 00305 END IF 00306 * 00307 * Quick return if possible 00308 * 00309 IF( M.EQ.0 .OR. N.EQ.0 ) 00310 $ RETURN 00311 * 00312 IF( APPLYQ ) THEN 00313 * 00314 * Apply Q 00315 * 00316 IF( NQ.GE.K ) THEN 00317 * 00318 * Q was determined by a call to ZGEBRD with nq >= k 00319 * 00320 CALL ZUNMQR( SIDE, TRANS, M, N, K, A, LDA, TAU, C, LDC, 00321 $ WORK, LWORK, IINFO ) 00322 ELSE IF( NQ.GT.1 ) THEN 00323 * 00324 * Q was determined by a call to ZGEBRD with nq < k 00325 * 00326 IF( LEFT ) THEN 00327 MI = M - 1 00328 NI = N 00329 I1 = 2 00330 I2 = 1 00331 ELSE 00332 MI = M 00333 NI = N - 1 00334 I1 = 1 00335 I2 = 2 00336 END IF 00337 CALL ZUNMQR( SIDE, TRANS, MI, NI, NQ-1, A( 2, 1 ), LDA, TAU, 00338 $ C( I1, I2 ), LDC, WORK, LWORK, IINFO ) 00339 END IF 00340 ELSE 00341 * 00342 * Apply P 00343 * 00344 IF( NOTRAN ) THEN 00345 TRANST = 'C' 00346 ELSE 00347 TRANST = 'N' 00348 END IF 00349 IF( NQ.GT.K ) THEN 00350 * 00351 * P was determined by a call to ZGEBRD with nq > k 00352 * 00353 CALL ZUNMLQ( SIDE, TRANST, M, N, K, A, LDA, TAU, C, LDC, 00354 $ WORK, LWORK, IINFO ) 00355 ELSE IF( NQ.GT.1 ) THEN 00356 * 00357 * P was determined by a call to ZGEBRD with nq <= k 00358 * 00359 IF( LEFT ) THEN 00360 MI = M - 1 00361 NI = N 00362 I1 = 2 00363 I2 = 1 00364 ELSE 00365 MI = M 00366 NI = N - 1 00367 I1 = 1 00368 I2 = 2 00369 END IF 00370 CALL ZUNMLQ( SIDE, TRANST, MI, NI, NQ-1, A( 1, 2 ), LDA, 00371 $ TAU, C( I1, I2 ), LDC, WORK, LWORK, IINFO ) 00372 END IF 00373 END IF 00374 WORK( 1 ) = LWKOPT 00375 RETURN 00376 * 00377 * End of ZUNMBR 00378 * 00379 END