Annotation of rpl/lapack/lapack/zunmbr.f, revision 1.8
1.8 ! bertrand 1: *> \brief \b ZUNMBR
! 2: *
! 3: * =========== DOCUMENTATION ===========
! 4: *
! 5: * Online html documentation available at
! 6: * http://www.netlib.org/lapack/explore-html/
! 7: *
! 8: *> \htmlonly
! 9: *> Download ZUNMBR + dependencies
! 10: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zunmbr.f">
! 11: *> [TGZ]</a>
! 12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zunmbr.f">
! 13: *> [ZIP]</a>
! 14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zunmbr.f">
! 15: *> [TXT]</a>
! 16: *> \endhtmlonly
! 17: *
! 18: * Definition:
! 19: * ===========
! 20: *
! 21: * SUBROUTINE ZUNMBR( VECT, SIDE, TRANS, M, N, K, A, LDA, TAU, C,
! 22: * LDC, WORK, LWORK, INFO )
! 23: *
! 24: * .. Scalar Arguments ..
! 25: * CHARACTER SIDE, TRANS, VECT
! 26: * INTEGER INFO, K, LDA, LDC, LWORK, M, N
! 27: * ..
! 28: * .. Array Arguments ..
! 29: * COMPLEX*16 A( LDA, * ), C( LDC, * ), TAU( * ), WORK( * )
! 30: * ..
! 31: *
! 32: *
! 33: *> \par Purpose:
! 34: * =============
! 35: *>
! 36: *> \verbatim
! 37: *>
! 38: *> If VECT = 'Q', ZUNMBR overwrites the general complex M-by-N matrix C
! 39: *> with
! 40: *> SIDE = 'L' SIDE = 'R'
! 41: *> TRANS = 'N': Q * C C * Q
! 42: *> TRANS = 'C': Q**H * C C * Q**H
! 43: *>
! 44: *> If VECT = 'P', ZUNMBR overwrites the general complex M-by-N matrix C
! 45: *> with
! 46: *> SIDE = 'L' SIDE = 'R'
! 47: *> TRANS = 'N': P * C C * P
! 48: *> TRANS = 'C': P**H * C C * P**H
! 49: *>
! 50: *> Here Q and P**H are the unitary matrices determined by ZGEBRD when
! 51: *> reducing a complex matrix A to bidiagonal form: A = Q * B * P**H. Q
! 52: *> and P**H are defined as products of elementary reflectors H(i) and
! 53: *> G(i) respectively.
! 54: *>
! 55: *> Let nq = m if SIDE = 'L' and nq = n if SIDE = 'R'. Thus nq is the
! 56: *> order of the unitary matrix Q or P**H that is applied.
! 57: *>
! 58: *> If VECT = 'Q', A is assumed to have been an NQ-by-K matrix:
! 59: *> if nq >= k, Q = H(1) H(2) . . . H(k);
! 60: *> if nq < k, Q = H(1) H(2) . . . H(nq-1).
! 61: *>
! 62: *> If VECT = 'P', A is assumed to have been a K-by-NQ matrix:
! 63: *> if k < nq, P = G(1) G(2) . . . G(k);
! 64: *> if k >= nq, P = G(1) G(2) . . . G(nq-1).
! 65: *> \endverbatim
! 66: *
! 67: * Arguments:
! 68: * ==========
! 69: *
! 70: *> \param[in] VECT
! 71: *> \verbatim
! 72: *> VECT is CHARACTER*1
! 73: *> = 'Q': apply Q or Q**H;
! 74: *> = 'P': apply P or P**H.
! 75: *> \endverbatim
! 76: *>
! 77: *> \param[in] SIDE
! 78: *> \verbatim
! 79: *> SIDE is CHARACTER*1
! 80: *> = 'L': apply Q, Q**H, P or P**H from the Left;
! 81: *> = 'R': apply Q, Q**H, P or P**H from the Right.
! 82: *> \endverbatim
! 83: *>
! 84: *> \param[in] TRANS
! 85: *> \verbatim
! 86: *> TRANS is CHARACTER*1
! 87: *> = 'N': No transpose, apply Q or P;
! 88: *> = 'C': Conjugate transpose, apply Q**H or P**H.
! 89: *> \endverbatim
! 90: *>
! 91: *> \param[in] M
! 92: *> \verbatim
! 93: *> M is INTEGER
! 94: *> The number of rows of the matrix C. M >= 0.
! 95: *> \endverbatim
! 96: *>
! 97: *> \param[in] N
! 98: *> \verbatim
! 99: *> N is INTEGER
! 100: *> The number of columns of the matrix C. N >= 0.
! 101: *> \endverbatim
! 102: *>
! 103: *> \param[in] K
! 104: *> \verbatim
! 105: *> K is INTEGER
! 106: *> If VECT = 'Q', the number of columns in the original
! 107: *> matrix reduced by ZGEBRD.
! 108: *> If VECT = 'P', the number of rows in the original
! 109: *> matrix reduced by ZGEBRD.
! 110: *> K >= 0.
! 111: *> \endverbatim
! 112: *>
! 113: *> \param[in] A
! 114: *> \verbatim
! 115: *> A is COMPLEX*16 array, dimension
! 116: *> (LDA,min(nq,K)) if VECT = 'Q'
! 117: *> (LDA,nq) if VECT = 'P'
! 118: *> The vectors which define the elementary reflectors H(i) and
! 119: *> G(i), whose products determine the matrices Q and P, as
! 120: *> returned by ZGEBRD.
! 121: *> \endverbatim
! 122: *>
! 123: *> \param[in] LDA
! 124: *> \verbatim
! 125: *> LDA is INTEGER
! 126: *> The leading dimension of the array A.
! 127: *> If VECT = 'Q', LDA >= max(1,nq);
! 128: *> if VECT = 'P', LDA >= max(1,min(nq,K)).
! 129: *> \endverbatim
! 130: *>
! 131: *> \param[in] TAU
! 132: *> \verbatim
! 133: *> TAU is COMPLEX*16 array, dimension (min(nq,K))
! 134: *> TAU(i) must contain the scalar factor of the elementary
! 135: *> reflector H(i) or G(i) which determines Q or P, as returned
! 136: *> by ZGEBRD in the array argument TAUQ or TAUP.
! 137: *> \endverbatim
! 138: *>
! 139: *> \param[in,out] C
! 140: *> \verbatim
! 141: *> C is COMPLEX*16 array, dimension (LDC,N)
! 142: *> On entry, the M-by-N matrix C.
! 143: *> On exit, C is overwritten by Q*C or Q**H*C or C*Q**H or C*Q
! 144: *> or P*C or P**H*C or C*P or C*P**H.
! 145: *> \endverbatim
! 146: *>
! 147: *> \param[in] LDC
! 148: *> \verbatim
! 149: *> LDC is INTEGER
! 150: *> The leading dimension of the array C. LDC >= max(1,M).
! 151: *> \endverbatim
! 152: *>
! 153: *> \param[out] WORK
! 154: *> \verbatim
! 155: *> WORK is COMPLEX*16 array, dimension (MAX(1,LWORK))
! 156: *> On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
! 157: *> \endverbatim
! 158: *>
! 159: *> \param[in] LWORK
! 160: *> \verbatim
! 161: *> LWORK is INTEGER
! 162: *> The dimension of the array WORK.
! 163: *> If SIDE = 'L', LWORK >= max(1,N);
! 164: *> if SIDE = 'R', LWORK >= max(1,M);
! 165: *> if N = 0 or M = 0, LWORK >= 1.
! 166: *> For optimum performance LWORK >= max(1,N*NB) if SIDE = 'L',
! 167: *> and LWORK >= max(1,M*NB) if SIDE = 'R', where NB is the
! 168: *> optimal blocksize. (NB = 0 if M = 0 or N = 0.)
! 169: *>
! 170: *> If LWORK = -1, then a workspace query is assumed; the routine
! 171: *> only calculates the optimal size of the WORK array, returns
! 172: *> this value as the first entry of the WORK array, and no error
! 173: *> message related to LWORK is issued by XERBLA.
! 174: *> \endverbatim
! 175: *>
! 176: *> \param[out] INFO
! 177: *> \verbatim
! 178: *> INFO is INTEGER
! 179: *> = 0: successful exit
! 180: *> < 0: if INFO = -i, the i-th argument had an illegal value
! 181: *> \endverbatim
! 182: *
! 183: * Authors:
! 184: * ========
! 185: *
! 186: *> \author Univ. of Tennessee
! 187: *> \author Univ. of California Berkeley
! 188: *> \author Univ. of Colorado Denver
! 189: *> \author NAG Ltd.
! 190: *
! 191: *> \date November 2011
! 192: *
! 193: *> \ingroup complex16OTHERcomputational
! 194: *
! 195: * =====================================================================
1.1 bertrand 196: SUBROUTINE ZUNMBR( VECT, SIDE, TRANS, M, N, K, A, LDA, TAU, C,
197: $ LDC, WORK, LWORK, INFO )
198: *
1.8 ! bertrand 199: * -- LAPACK computational routine (version 3.4.0) --
1.1 bertrand 200: * -- LAPACK is a software package provided by Univ. of Tennessee, --
201: * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
1.8 ! bertrand 202: * November 2011
1.1 bertrand 203: *
204: * .. Scalar Arguments ..
205: CHARACTER SIDE, TRANS, VECT
206: INTEGER INFO, K, LDA, LDC, LWORK, M, N
207: * ..
208: * .. Array Arguments ..
209: COMPLEX*16 A( LDA, * ), C( LDC, * ), TAU( * ), WORK( * )
210: * ..
211: *
212: * =====================================================================
213: *
214: * .. Local Scalars ..
215: LOGICAL APPLYQ, LEFT, LQUERY, NOTRAN
216: CHARACTER TRANST
217: INTEGER I1, I2, IINFO, LWKOPT, MI, NB, NI, NQ, NW
218: * ..
219: * .. External Functions ..
220: LOGICAL LSAME
221: INTEGER ILAENV
222: EXTERNAL LSAME, ILAENV
223: * ..
224: * .. External Subroutines ..
225: EXTERNAL XERBLA, ZUNMLQ, ZUNMQR
226: * ..
227: * .. Intrinsic Functions ..
228: INTRINSIC MAX, MIN
229: * ..
230: * .. Executable Statements ..
231: *
232: * Test the input arguments
233: *
234: INFO = 0
235: APPLYQ = LSAME( VECT, 'Q' )
236: LEFT = LSAME( SIDE, 'L' )
237: NOTRAN = LSAME( TRANS, 'N' )
238: LQUERY = ( LWORK.EQ.-1 )
239: *
240: * NQ is the order of Q or P and NW is the minimum dimension of WORK
241: *
242: IF( LEFT ) THEN
243: NQ = M
244: NW = N
245: ELSE
246: NQ = N
247: NW = M
248: END IF
249: IF( M.EQ.0 .OR. N.EQ.0 ) THEN
250: NW = 0
251: END IF
252: IF( .NOT.APPLYQ .AND. .NOT.LSAME( VECT, 'P' ) ) THEN
253: INFO = -1
254: ELSE IF( .NOT.LEFT .AND. .NOT.LSAME( SIDE, 'R' ) ) THEN
255: INFO = -2
256: ELSE IF( .NOT.NOTRAN .AND. .NOT.LSAME( TRANS, 'C' ) ) THEN
257: INFO = -3
258: ELSE IF( M.LT.0 ) THEN
259: INFO = -4
260: ELSE IF( N.LT.0 ) THEN
261: INFO = -5
262: ELSE IF( K.LT.0 ) THEN
263: INFO = -6
264: ELSE IF( ( APPLYQ .AND. LDA.LT.MAX( 1, NQ ) ) .OR.
265: $ ( .NOT.APPLYQ .AND. LDA.LT.MAX( 1, MIN( NQ, K ) ) ) )
266: $ THEN
267: INFO = -8
268: ELSE IF( LDC.LT.MAX( 1, M ) ) THEN
269: INFO = -11
270: ELSE IF( LWORK.LT.MAX( 1, NW ) .AND. .NOT.LQUERY ) THEN
271: INFO = -13
272: END IF
273: *
274: IF( INFO.EQ.0 ) THEN
275: IF( NW.GT.0 ) THEN
276: IF( APPLYQ ) THEN
277: IF( LEFT ) THEN
278: NB = ILAENV( 1, 'ZUNMQR', SIDE // TRANS, M-1, N, M-1,
279: $ -1 )
280: ELSE
281: NB = ILAENV( 1, 'ZUNMQR', SIDE // TRANS, M, N-1, N-1,
282: $ -1 )
283: END IF
284: ELSE
285: IF( LEFT ) THEN
286: NB = ILAENV( 1, 'ZUNMLQ', SIDE // TRANS, M-1, N, M-1,
287: $ -1 )
288: ELSE
289: NB = ILAENV( 1, 'ZUNMLQ', SIDE // TRANS, M, N-1, N-1,
290: $ -1 )
291: END IF
292: END IF
293: LWKOPT = MAX( 1, NW*NB )
294: ELSE
295: LWKOPT = 1
296: END IF
297: WORK( 1 ) = LWKOPT
298: END IF
299: *
300: IF( INFO.NE.0 ) THEN
301: CALL XERBLA( 'ZUNMBR', -INFO )
302: RETURN
303: ELSE IF( LQUERY ) THEN
304: RETURN
305: END IF
306: *
307: * Quick return if possible
308: *
309: IF( M.EQ.0 .OR. N.EQ.0 )
310: $ RETURN
311: *
312: IF( APPLYQ ) THEN
313: *
314: * Apply Q
315: *
316: IF( NQ.GE.K ) THEN
317: *
318: * Q was determined by a call to ZGEBRD with nq >= k
319: *
320: CALL ZUNMQR( SIDE, TRANS, M, N, K, A, LDA, TAU, C, LDC,
321: $ WORK, LWORK, IINFO )
322: ELSE IF( NQ.GT.1 ) THEN
323: *
324: * Q was determined by a call to ZGEBRD with nq < k
325: *
326: IF( LEFT ) THEN
327: MI = M - 1
328: NI = N
329: I1 = 2
330: I2 = 1
331: ELSE
332: MI = M
333: NI = N - 1
334: I1 = 1
335: I2 = 2
336: END IF
337: CALL ZUNMQR( SIDE, TRANS, MI, NI, NQ-1, A( 2, 1 ), LDA, TAU,
338: $ C( I1, I2 ), LDC, WORK, LWORK, IINFO )
339: END IF
340: ELSE
341: *
342: * Apply P
343: *
344: IF( NOTRAN ) THEN
345: TRANST = 'C'
346: ELSE
347: TRANST = 'N'
348: END IF
349: IF( NQ.GT.K ) THEN
350: *
351: * P was determined by a call to ZGEBRD with nq > k
352: *
353: CALL ZUNMLQ( SIDE, TRANST, M, N, K, A, LDA, TAU, C, LDC,
354: $ WORK, LWORK, IINFO )
355: ELSE IF( NQ.GT.1 ) THEN
356: *
357: * P was determined by a call to ZGEBRD with nq <= k
358: *
359: IF( LEFT ) THEN
360: MI = M - 1
361: NI = N
362: I1 = 2
363: I2 = 1
364: ELSE
365: MI = M
366: NI = N - 1
367: I1 = 1
368: I2 = 2
369: END IF
370: CALL ZUNMLQ( SIDE, TRANST, MI, NI, NQ-1, A( 1, 2 ), LDA,
371: $ TAU, C( I1, I2 ), LDC, WORK, LWORK, IINFO )
372: END IF
373: END IF
374: WORK( 1 ) = LWKOPT
375: RETURN
376: *
377: * End of ZUNMBR
378: *
379: END
CVSweb interface <joel.bertrand@systella.fr>