LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
cunmrz.f
Go to the documentation of this file.
1*> \brief \b CUNMRZ
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download CUNMRZ + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cunmrz.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cunmrz.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cunmrz.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE CUNMRZ( SIDE, TRANS, M, N, K, L, A, LDA, TAU, C, LDC,
20* WORK, LWORK, INFO )
21*
22* .. Scalar Arguments ..
23* CHARACTER SIDE, TRANS
24* INTEGER INFO, K, L, LDA, LDC, LWORK, M, N
25* ..
26* .. Array Arguments ..
27* COMPLEX A( LDA, * ), C( LDC, * ), TAU( * ), WORK( * )
28* ..
29*
30*
31*> \par Purpose:
32* =============
33*>
34*> \verbatim
35*>
36*> CUNMRZ overwrites the general complex M-by-N matrix C with
37*>
38*> SIDE = 'L' SIDE = 'R'
39*> TRANS = 'N': Q * C C * Q
40*> TRANS = 'C': Q**H * C C * Q**H
41*>
42*> where Q is a complex unitary matrix defined as the product of k
43*> elementary reflectors
44*>
45*> Q = H(1) H(2) . . . H(k)
46*>
47*> as returned by CTZRZF. Q is of order M if SIDE = 'L' and of order N
48*> if SIDE = 'R'.
49*> \endverbatim
50*
51* Arguments:
52* ==========
53*
54*> \param[in] SIDE
55*> \verbatim
56*> SIDE is CHARACTER*1
57*> = 'L': apply Q or Q**H from the Left;
58*> = 'R': apply Q or Q**H from the Right.
59*> \endverbatim
60*>
61*> \param[in] TRANS
62*> \verbatim
63*> TRANS is CHARACTER*1
64*> = 'N': No transpose, apply Q;
65*> = 'C': Conjugate transpose, apply Q**H.
66*> \endverbatim
67*>
68*> \param[in] M
69*> \verbatim
70*> M is INTEGER
71*> The number of rows of the matrix C. M >= 0.
72*> \endverbatim
73*>
74*> \param[in] N
75*> \verbatim
76*> N is INTEGER
77*> The number of columns of the matrix C. N >= 0.
78*> \endverbatim
79*>
80*> \param[in] K
81*> \verbatim
82*> K is INTEGER
83*> The number of elementary reflectors whose product defines
84*> the matrix Q.
85*> If SIDE = 'L', M >= K >= 0;
86*> if SIDE = 'R', N >= K >= 0.
87*> \endverbatim
88*>
89*> \param[in] L
90*> \verbatim
91*> L is INTEGER
92*> The number of columns of the matrix A containing
93*> the meaningful part of the Householder reflectors.
94*> If SIDE = 'L', M >= L >= 0, if SIDE = 'R', N >= L >= 0.
95*> \endverbatim
96*>
97*> \param[in] A
98*> \verbatim
99*> A is COMPLEX array, dimension
100*> (LDA,M) if SIDE = 'L',
101*> (LDA,N) if SIDE = 'R'
102*> The i-th row must contain the vector which defines the
103*> elementary reflector H(i), for i = 1,2,...,k, as returned by
104*> CTZRZF in the last k rows of its array argument A.
105*> A is modified by the routine but restored on exit.
106*> \endverbatim
107*>
108*> \param[in] LDA
109*> \verbatim
110*> LDA is INTEGER
111*> The leading dimension of the array A. LDA >= max(1,K).
112*> \endverbatim
113*>
114*> \param[in] TAU
115*> \verbatim
116*> TAU is COMPLEX array, dimension (K)
117*> TAU(i) must contain the scalar factor of the elementary
118*> reflector H(i), as returned by CTZRZF.
119*> \endverbatim
120*>
121*> \param[in,out] C
122*> \verbatim
123*> C is COMPLEX array, dimension (LDC,N)
124*> On entry, the M-by-N matrix C.
125*> On exit, C is overwritten by Q*C or Q**H*C or C*Q**H or C*Q.
126*> \endverbatim
127*>
128*> \param[in] LDC
129*> \verbatim
130*> LDC is INTEGER
131*> The leading dimension of the array C. LDC >= max(1,M).
132*> \endverbatim
133*>
134*> \param[out] WORK
135*> \verbatim
136*> WORK is COMPLEX array, dimension (MAX(1,LWORK))
137*> On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
138*> \endverbatim
139*>
140*> \param[in] LWORK
141*> \verbatim
142*> LWORK is INTEGER
143*> The dimension of the array WORK.
144*> If SIDE = 'L', LWORK >= max(1,N);
145*> if SIDE = 'R', LWORK >= max(1,M).
146*> For good performance, LWORK should generally be larger.
147*>
148*> If LWORK = -1, then a workspace query is assumed; the routine
149*> only calculates the optimal size of the WORK array, returns
150*> this value as the first entry of the WORK array, and no error
151*> message related to LWORK is issued by XERBLA.
152*> \endverbatim
153*>
154*> \param[out] INFO
155*> \verbatim
156*> INFO is INTEGER
157*> = 0: successful exit
158*> < 0: if INFO = -i, the i-th argument had an illegal value
159*> \endverbatim
160*
161* Authors:
162* ========
163*
164*> \author Univ. of Tennessee
165*> \author Univ. of California Berkeley
166*> \author Univ. of Colorado Denver
167*> \author NAG Ltd.
168*
169*> \ingroup unmrz
170*
171*> \par Contributors:
172* ==================
173*>
174*> A. Petitet, Computer Science Dept., Univ. of Tenn., Knoxville, USA
175*
176*> \par Further Details:
177* =====================
178*>
179*> \verbatim
180*> \endverbatim
181*>
182* =====================================================================
183 SUBROUTINE cunmrz( SIDE, TRANS, M, N, K, L, A, LDA, TAU, C,
184 $ LDC,
185 $ WORK, LWORK, INFO )
186*
187* -- LAPACK computational routine --
188* -- LAPACK is a software package provided by Univ. of Tennessee, --
189* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
190*
191* .. Scalar Arguments ..
192 CHARACTER SIDE, TRANS
193 INTEGER INFO, K, L, LDA, LDC, LWORK, M, N
194* ..
195* .. Array Arguments ..
196 COMPLEX A( LDA, * ), C( LDC, * ), TAU( * ), WORK( * )
197* ..
198*
199* =====================================================================
200*
201* .. Parameters ..
202 INTEGER NBMAX, LDT, TSIZE
203 PARAMETER ( NBMAX = 64, ldt = nbmax+1,
204 $ tsize = ldt*nbmax )
205* ..
206* .. Local Scalars ..
207 LOGICAL LEFT, LQUERY, NOTRAN
208 CHARACTER TRANST
209 INTEGER I, I1, I2, I3, IB, IC, IINFO, IWT, JA, JC,
210 $ ldwork, lwkopt, mi, nb, nbmin, ni, nq, nw
211* ..
212* .. External Functions ..
213 LOGICAL LSAME
214 INTEGER ILAENV
215 REAL SROUNDUP_LWORK
216 EXTERNAL lsame, ilaenv, sroundup_lwork
217* ..
218* .. External Subroutines ..
219 EXTERNAL clarzb, clarzt, cunmr3, xerbla
220* ..
221* .. Intrinsic Functions ..
222 INTRINSIC max, min
223* ..
224* .. Executable Statements ..
225*
226* Test the input arguments
227*
228 info = 0
229 left = lsame( side, 'L' )
230 notran = lsame( trans, 'N' )
231 lquery = ( lwork.EQ.-1 )
232*
233* NQ is the order of Q and NW is the minimum dimension of WORK
234*
235 IF( left ) THEN
236 nq = m
237 nw = max( 1, n )
238 ELSE
239 nq = n
240 nw = max( 1, m )
241 END IF
242 IF( .NOT.left .AND. .NOT.lsame( side, 'R' ) ) THEN
243 info = -1
244 ELSE IF( .NOT.notran .AND. .NOT.lsame( trans, 'C' ) ) THEN
245 info = -2
246 ELSE IF( m.LT.0 ) THEN
247 info = -3
248 ELSE IF( n.LT.0 ) THEN
249 info = -4
250 ELSE IF( k.LT.0 .OR. k.GT.nq ) THEN
251 info = -5
252 ELSE IF( l.LT.0 .OR. ( left .AND. ( l.GT.m ) ) .OR.
253 $ ( .NOT.left .AND. ( l.GT.n ) ) ) THEN
254 info = -6
255 ELSE IF( lda.LT.max( 1, k ) ) THEN
256 info = -8
257 ELSE IF( ldc.LT.max( 1, m ) ) THEN
258 info = -11
259 ELSE IF( lwork.LT.nw .AND. .NOT.lquery ) THEN
260 info = -13
261 END IF
262*
263 IF( info.EQ.0 ) THEN
264*
265* Compute the workspace requirements
266*
267 IF( m.EQ.0 .OR. n.EQ.0 ) THEN
268 lwkopt = 1
269 ELSE
270 nb = min( nbmax, ilaenv( 1, 'CUNMRQ', side // trans, m,
271 $ n,
272 $ k, -1 ) )
273 lwkopt = nw*nb + tsize
274 END IF
275 work( 1 ) = sroundup_lwork(lwkopt)
276 END IF
277*
278 IF( info.NE.0 ) THEN
279 CALL xerbla( 'CUNMRZ', -info )
280 RETURN
281 ELSE IF( lquery ) THEN
282 RETURN
283 END IF
284*
285* Quick return if possible
286*
287 IF( m.EQ.0 .OR. n.EQ.0 ) THEN
288 RETURN
289 END IF
290*
291* Determine the block size.
292*
293 nb = min( nbmax, ilaenv( 1, 'CUNMRQ', side // trans, m, n, k,
294 $ -1 ) )
295 nbmin = 2
296 ldwork = nw
297 IF( nb.GT.1 .AND. nb.LT.k ) THEN
298 IF( lwork.LT.lwkopt ) THEN
299 nb = (lwork-tsize) / ldwork
300 nbmin = max( 2, ilaenv( 2, 'CUNMRQ', side // trans, m, n,
301 $ k,
302 $ -1 ) )
303 END IF
304 END IF
305*
306 IF( nb.LT.nbmin .OR. nb.GE.k ) THEN
307*
308* Use unblocked code
309*
310 CALL cunmr3( side, trans, m, n, k, l, a, lda, tau, c, ldc,
311 $ work, iinfo )
312 ELSE
313*
314* Use blocked code
315*
316 iwt = 1 + nw*nb
317 IF( ( left .AND. .NOT.notran ) .OR.
318 $ ( .NOT.left .AND. notran ) ) THEN
319 i1 = 1
320 i2 = k
321 i3 = nb
322 ELSE
323 i1 = ( ( k-1 ) / nb )*nb + 1
324 i2 = 1
325 i3 = -nb
326 END IF
327*
328 IF( left ) THEN
329 ni = n
330 jc = 1
331 ja = m - l + 1
332 ELSE
333 mi = m
334 ic = 1
335 ja = n - l + 1
336 END IF
337*
338 IF( notran ) THEN
339 transt = 'C'
340 ELSE
341 transt = 'N'
342 END IF
343*
344 DO 10 i = i1, i2, i3
345 ib = min( nb, k-i+1 )
346*
347* Form the triangular factor of the block reflector
348* H = H(i+ib-1) . . . H(i+1) H(i)
349*
350 CALL clarzt( 'Backward', 'Rowwise', l, ib, a( i, ja ),
351 $ lda,
352 $ tau( i ), work( iwt ), ldt )
353*
354 IF( left ) THEN
355*
356* H or H**H is applied to C(i:m,1:n)
357*
358 mi = m - i + 1
359 ic = i
360 ELSE
361*
362* H or H**H is applied to C(1:m,i:n)
363*
364 ni = n - i + 1
365 jc = i
366 END IF
367*
368* Apply H or H**H
369*
370 CALL clarzb( side, transt, 'Backward', 'Rowwise', mi, ni,
371 $ ib, l, a( i, ja ), lda, work( iwt ), ldt,
372 $ c( ic, jc ), ldc, work, ldwork )
373 10 CONTINUE
374*
375 END IF
376*
377 work( 1 ) = sroundup_lwork(lwkopt)
378*
379 RETURN
380*
381* End of CUNMRZ
382*
383 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine clarzb(side, trans, direct, storev, m, n, k, l, v, ldv, t, ldt, c, ldc, work, ldwork)
CLARZB applies a block reflector or its conjugate-transpose to a general matrix.
Definition clarzb.f:181
subroutine clarzt(direct, storev, n, k, v, ldv, tau, t, ldt)
CLARZT forms the triangular factor T of a block reflector H = I - vtvH.
Definition clarzt.f:183
subroutine cunmr3(side, trans, m, n, k, l, a, lda, tau, c, ldc, work, info)
CUNMR3 multiplies a general matrix by the unitary matrix from a RZ factorization determined by ctzrzf...
Definition cunmr3.f:177
subroutine cunmrz(side, trans, m, n, k, l, a, lda, tau, c, ldc, work, lwork, info)
CUNMRZ
Definition cunmrz.f:186