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