Annotation of rpl/lapack/lapack/dormlq.f, revision 1.9
1.9 ! bertrand 1: *> \brief \b DORMLQ
! 2: *
! 3: * =========== DOCUMENTATION ===========
! 4: *
! 5: * Online html documentation available at
! 6: * http://www.netlib.org/lapack/explore-html/
! 7: *
! 8: *> \htmlonly
! 9: *> Download DORMLQ + dependencies
! 10: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dormlq.f">
! 11: *> [TGZ]</a>
! 12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dormlq.f">
! 13: *> [ZIP]</a>
! 14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dormlq.f">
! 15: *> [TXT]</a>
! 16: *> \endhtmlonly
! 17: *
! 18: * Definition:
! 19: * ===========
! 20: *
! 21: * SUBROUTINE DORMLQ( 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: * DOUBLE PRECISION A( LDA, * ), C( LDC, * ), TAU( * ), WORK( * )
! 30: * ..
! 31: *
! 32: *
! 33: *> \par Purpose:
! 34: * =============
! 35: *>
! 36: *> \verbatim
! 37: *>
! 38: *> DORMLQ overwrites the general real M-by-N matrix C with
! 39: *>
! 40: *> SIDE = 'L' SIDE = 'R'
! 41: *> TRANS = 'N': Q * C C * Q
! 42: *> TRANS = 'T': Q**T * C C * Q**T
! 43: *>
! 44: *> where Q is a real orthogonal matrix defined as the product of k
! 45: *> elementary reflectors
! 46: *>
! 47: *> Q = H(k) . . . H(2) H(1)
! 48: *>
! 49: *> as returned by DGELQF. 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**T from the Left;
! 60: *> = 'R': apply Q or Q**T from the Right.
! 61: *> \endverbatim
! 62: *>
! 63: *> \param[in] TRANS
! 64: *> \verbatim
! 65: *> TRANS is CHARACTER*1
! 66: *> = 'N': No transpose, apply Q;
! 67: *> = 'T': Transpose, apply Q**T.
! 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 DOUBLE PRECISION 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: *> DGELQF in the first 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 DOUBLE PRECISION array, dimension (K)
! 111: *> TAU(i) must contain the scalar factor of the elementary
! 112: *> reflector H(i), as returned by DGELQF.
! 113: *> \endverbatim
! 114: *>
! 115: *> \param[in,out] C
! 116: *> \verbatim
! 117: *> C is DOUBLE PRECISION array, dimension (LDC,N)
! 118: *> On entry, the M-by-N matrix C.
! 119: *> On exit, C is overwritten by Q*C or Q**T*C or C*Q**T 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 DOUBLE PRECISION 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 doubleOTHERcomputational
! 168: *
! 169: * =====================================================================
1.1 bertrand 170: SUBROUTINE DORMLQ( 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: DOUBLE PRECISION 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, IC, IINFO, IWS, JC, LDWORK,
196: $ LWKOPT, MI, NB, NBMIN, NI, NQ, NW
197: * ..
198: * .. Local Arrays ..
199: DOUBLE PRECISION T( LDT, NBMAX )
200: * ..
201: * .. External Functions ..
202: LOGICAL LSAME
203: INTEGER ILAENV
204: EXTERNAL LSAME, ILAENV
205: * ..
206: * .. External Subroutines ..
207: EXTERNAL DLARFB, DLARFT, DORML2, XERBLA
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 = N
226: ELSE
227: NQ = N
228: NW = 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, 'T' ) ) 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: ELSE IF( LWORK.LT.MAX( 1, NW ) .AND. .NOT.LQUERY ) THEN
245: INFO = -12
246: END IF
247: *
248: IF( INFO.EQ.0 ) THEN
249: *
250: * Determine the block size. NB may be at most NBMAX, where NBMAX
251: * is used to define the local array T.
252: *
253: NB = MIN( NBMAX, ILAENV( 1, 'DORMLQ', SIDE // TRANS, M, N, K,
254: $ -1 ) )
255: LWKOPT = MAX( 1, NW )*NB
256: WORK( 1 ) = LWKOPT
257: END IF
258: *
259: IF( INFO.NE.0 ) THEN
260: CALL XERBLA( 'DORMLQ', -INFO )
261: RETURN
262: ELSE IF( LQUERY ) THEN
263: RETURN
264: END IF
265: *
266: * Quick return if possible
267: *
268: IF( M.EQ.0 .OR. N.EQ.0 .OR. K.EQ.0 ) THEN
269: WORK( 1 ) = 1
270: RETURN
271: END IF
272: *
273: NBMIN = 2
274: LDWORK = NW
275: IF( NB.GT.1 .AND. NB.LT.K ) THEN
276: IWS = NW*NB
277: IF( LWORK.LT.IWS ) THEN
278: NB = LWORK / LDWORK
279: NBMIN = MAX( 2, ILAENV( 2, 'DORMLQ', SIDE // TRANS, M, N, K,
280: $ -1 ) )
281: END IF
282: ELSE
283: IWS = NW
284: END IF
285: *
286: IF( NB.LT.NBMIN .OR. NB.GE.K ) THEN
287: *
288: * Use unblocked code
289: *
290: CALL DORML2( SIDE, TRANS, M, N, K, A, LDA, TAU, C, LDC, WORK,
291: $ IINFO )
292: ELSE
293: *
294: * Use blocked code
295: *
296: IF( ( LEFT .AND. NOTRAN ) .OR.
297: $ ( .NOT.LEFT .AND. .NOT.NOTRAN ) ) THEN
298: I1 = 1
299: I2 = K
300: I3 = NB
301: ELSE
302: I1 = ( ( K-1 ) / NB )*NB + 1
303: I2 = 1
304: I3 = -NB
305: END IF
306: *
307: IF( LEFT ) THEN
308: NI = N
309: JC = 1
310: ELSE
311: MI = M
312: IC = 1
313: END IF
314: *
315: IF( NOTRAN ) THEN
316: TRANST = 'T'
317: ELSE
318: TRANST = 'N'
319: END IF
320: *
321: DO 10 I = I1, I2, I3
322: IB = MIN( NB, K-I+1 )
323: *
324: * Form the triangular factor of the block reflector
325: * H = H(i) H(i+1) . . . H(i+ib-1)
326: *
327: CALL DLARFT( 'Forward', 'Rowwise', NQ-I+1, IB, A( I, I ),
328: $ LDA, TAU( I ), T, LDT )
329: IF( LEFT ) THEN
330: *
1.8 bertrand 331: * H or H**T is applied to C(i:m,1:n)
1.1 bertrand 332: *
333: MI = M - I + 1
334: IC = I
335: ELSE
336: *
1.8 bertrand 337: * H or H**T is applied to C(1:m,i:n)
1.1 bertrand 338: *
339: NI = N - I + 1
340: JC = I
341: END IF
342: *
1.8 bertrand 343: * Apply H or H**T
1.1 bertrand 344: *
345: CALL DLARFB( SIDE, TRANST, 'Forward', 'Rowwise', MI, NI, IB,
346: $ A( I, I ), LDA, T, LDT, C( IC, JC ), LDC, WORK,
347: $ LDWORK )
348: 10 CONTINUE
349: END IF
350: WORK( 1 ) = LWKOPT
351: RETURN
352: *
353: * End of DORMLQ
354: *
355: END
CVSweb interface <joel.bertrand@systella.fr>