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