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