3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download CUNMQL + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cunmql.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cunmql.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cunmql.f">
21 * SUBROUTINE CUNMQL( SIDE, TRANS, M, N, K, A, LDA, TAU, C, LDC,
24 * .. Scalar Arguments ..
25 * CHARACTER SIDE, TRANS
26 * INTEGER INFO, K, LDA, LDC, LWORK, M, N
28 * .. Array Arguments ..
29 * COMPLEX A( LDA, * ), C( LDC, * ), TAU( * ),
39 *> CUNMQL overwrites the general complex M-by-N matrix C with
41 *> SIDE = 'L' SIDE = 'R'
42 *> TRANS = 'N': Q * C C * Q
43 *> TRANS = 'C': Q**H * C C * Q**H
45 *> where Q is a complex unitary matrix defined as the product of k
46 *> elementary reflectors
48 *> Q = H(k) . . . H(2) H(1)
50 *> as returned by CGEQLF. Q is of order M if SIDE = 'L' and of order N
59 *> SIDE is CHARACTER*1
60 *> = 'L': apply Q or Q**H from the Left;
61 *> = 'R': apply Q or Q**H from the Right.
66 *> TRANS is CHARACTER*1
67 *> = 'N': No transpose, apply Q;
68 *> = 'C': Transpose, apply Q**H.
74 *> The number of rows of the matrix C. M >= 0.
80 *> The number of columns of the matrix C. N >= 0.
86 *> The number of elementary reflectors whose product defines
88 *> If SIDE = 'L', M >= K >= 0;
89 *> if SIDE = 'R', N >= K >= 0.
94 *> A is COMPLEX array, dimension (LDA,K)
95 *> The i-th column must contain the vector which defines the
96 *> elementary reflector H(i), for i = 1,2,...,k, as returned by
97 *> CGEQLF in the last k columns of its array argument A.
103 *> The leading dimension of the array A.
104 *> If SIDE = 'L', LDA >= max(1,M);
105 *> if SIDE = 'R', LDA >= max(1,N).
110 *> TAU is COMPLEX array, dimension (K)
111 *> TAU(i) must contain the scalar factor of the elementary
112 *> reflector H(i), as returned by CGEQLF.
117 *> C is COMPLEX 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.
125 *> The leading dimension of the array C. LDC >= max(1,M).
130 *> WORK is COMPLEX array, dimension (MAX(1,LWORK))
131 *> On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
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 good performance, LWORK should generally be larger.
142 *> If LWORK = -1, then a workspace query is assumed; the routine
143 *> only calculates the optimal size of the WORK array, returns
144 *> this value as the first entry of the WORK array, and no error
145 *> message related to LWORK is issued by XERBLA.
151 *> = 0: successful exit
152 *> < 0: if INFO = -i, the i-th argument had an illegal value
158 *> \author Univ. of Tennessee
159 *> \author Univ. of California Berkeley
160 *> \author Univ. of Colorado Denver
163 *> \date November 2015
165 *> \ingroup complexOTHERcomputational
167 * =====================================================================
168 SUBROUTINE CUNMQL( SIDE, TRANS, M, N, K, A, LDA, TAU, C, LDC,
169 $ WORK, LWORK, INFO )
171 * -- LAPACK computational routine (version 3.6.0) --
172 * -- LAPACK is a software package provided by Univ. of Tennessee, --
173 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
176 * .. Scalar Arguments ..
177 CHARACTER SIDE, TRANS
178 INTEGER INFO, K, LDA, LDC, LWORK, M, N
180 * .. Array Arguments ..
181 COMPLEX A( LDA, * ), C( LDC, * ), TAU( * ),
185 * =====================================================================
188 INTEGER NBMAX, LDT, TSIZE
189 PARAMETER ( NBMAX = 64, LDT = NBMAX+1,
190 $ TSIZE = LDT*NBMAX )
192 * .. Local Scalars ..
193 LOGICAL LEFT, LQUERY, NOTRAN
194 INTEGER I, I1, I2, I3, IB, IINFO, IWT, LDWORK, LWKOPT,
195 $ MI, NB, NBMIN, NI, NQ, NW
197 * .. External Functions ..
200 EXTERNAL LSAME, ILAENV
202 * .. External Subroutines ..
203 EXTERNAL CLARFB, CLARFT, CUNM2L, XERBLA
205 * .. Intrinsic Functions ..
208 * .. Executable Statements ..
210 * Test the input arguments
213 LEFT = LSAME( SIDE, 'L' )
214 NOTRAN = LSAME( TRANS, 'N' )
215 LQUERY = ( LWORK.EQ.-1 )
217 * NQ is the order of Q and NW is the minimum dimension of WORK
226 IF( .NOT.LEFT .AND. .NOT.LSAME( SIDE, 'R' ) ) THEN
228 ELSE IF( .NOT.NOTRAN .AND. .NOT.LSAME( TRANS, 'C' ) ) THEN
230 ELSE IF( M.LT.0 ) THEN
232 ELSE IF( N.LT.0 ) THEN
234 ELSE IF( K.LT.0 .OR. K.GT.NQ ) THEN
236 ELSE IF( LDA.LT.MAX( 1, NQ ) ) THEN
238 ELSE IF( LDC.LT.MAX( 1, M ) ) THEN
240 ELSE IF( LWORK.LT.NW .AND. .NOT.LQUERY ) THEN
246 * Compute the workspace requirements
248 IF( M.EQ.0 .OR. N.EQ.0 ) THEN
251 NB = MIN( NBMAX, ILAENV( 1, 'CUNMQL', SIDE // TRANS, M, N,
253 LWKOPT = NW*NB + TSIZE
259 CALL XERBLA( 'CUNMQL', -INFO )
261 ELSE IF( LQUERY ) THEN
265 * Quick return if possible
267 IF( M.EQ.0 .OR. N.EQ.0 ) THEN
271 * Determine the block size
275 IF( NB.GT.1 .AND. NB.LT.K ) THEN
276 IF( LWORK.LT.(NW*NB+TSIZE) ) THEN
277 NB = (LWORK-TSIZE) / LDWORK
278 NBMIN = MAX( 2, ILAENV( 2, 'CUNMQL', SIDE // TRANS, M, N, K,
283 IF( NB.LT.NBMIN .OR. NB.GE.K ) THEN
287 CALL CUNM2L( SIDE, TRANS, M, N, K, A, LDA, TAU, C, LDC, WORK,
294 IF( ( LEFT .AND. NOTRAN ) .OR.
295 $ ( .NOT.LEFT .AND. .NOT.NOTRAN ) ) THEN
300 I1 = ( ( K-1 ) / NB )*NB + 1
312 IB = MIN( NB, K-I+1 )
314 * Form the triangular factor of the block reflector
315 * H = H(i+ib-1) . . . H(i+1) H(i)
317 CALL CLARFT( 'Backward', 'Columnwise', NQ-K+I+IB-1, IB,
318 $ A( 1, I ), LDA, TAU( I ), WORK( IWT ), LDT )
321 * H or H**H is applied to C(1:m-k+i+ib-1,1:n)
323 MI = M - K + I + IB - 1
326 * H or H**H is applied to C(1:m,1:n-k+i+ib-1)
328 NI = N - K + I + IB - 1
333 CALL CLARFB( SIDE, TRANS, 'Backward', 'Columnwise', MI, NI,
334 $ IB, A( 1, I ), LDA, WORK( IWT ), LDT, C, LDC,