LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
zunmrz.f
Go to the documentation of this file.
1*> \brief \b ZUNMRZ
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download ZUNMRZ + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zunmrz.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zunmrz.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zunmrz.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE ZUNMRZ( 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*16 A( LDA, * ), C( LDC, * ), TAU( * ), WORK( * )
28* ..
29*
30*
31*> \par Purpose:
32* =============
33*>
34*> \verbatim
35*>
36*> ZUNMRZ 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 ZTZRZF. 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*16 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*> ZTZRZF 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*16 array, dimension (K)
117*> TAU(i) must contain the scalar factor of the elementary
118*> reflector H(i), as returned by ZTZRZF.
119*> \endverbatim
120*>
121*> \param[in,out] C
122*> \verbatim
123*> C is COMPLEX*16 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*16 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 zunmrz( 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*16 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 EXTERNAL lsame, ilaenv
216* ..
217* .. External Subroutines ..
218 EXTERNAL xerbla, zlarzb, zlarzt, zunmr3
219* ..
220* .. Intrinsic Functions ..
221 INTRINSIC max, min
222* ..
223* .. Executable Statements ..
224*
225* Test the input arguments
226*
227 info = 0
228 left = lsame( side, 'L' )
229 notran = lsame( trans, 'N' )
230 lquery = ( lwork.EQ.-1 )
231*
232* NQ is the order of Q and NW is the minimum dimension of WORK
233*
234 IF( left ) THEN
235 nq = m
236 nw = max( 1, n )
237 ELSE
238 nq = n
239 nw = max( 1, m )
240 END IF
241 IF( .NOT.left .AND. .NOT.lsame( side, 'R' ) ) THEN
242 info = -1
243 ELSE IF( .NOT.notran .AND. .NOT.lsame( trans, 'C' ) ) THEN
244 info = -2
245 ELSE IF( m.LT.0 ) THEN
246 info = -3
247 ELSE IF( n.LT.0 ) THEN
248 info = -4
249 ELSE IF( k.LT.0 .OR. k.GT.nq ) THEN
250 info = -5
251 ELSE IF( l.LT.0 .OR. ( left .AND. ( l.GT.m ) ) .OR.
252 $ ( .NOT.left .AND. ( l.GT.n ) ) ) THEN
253 info = -6
254 ELSE IF( lda.LT.max( 1, k ) ) THEN
255 info = -8
256 ELSE IF( ldc.LT.max( 1, m ) ) THEN
257 info = -11
258 ELSE IF( lwork.LT.max( 1, nw ) .AND. .NOT.lquery ) THEN
259 info = -13
260 END IF
261*
262 IF( info.EQ.0 ) THEN
263*
264* Compute the workspace requirements
265*
266 IF( m.EQ.0 .OR. n.EQ.0 ) THEN
267 lwkopt = 1
268 ELSE
269 nb = min( nbmax, ilaenv( 1, 'ZUNMRQ', side // trans, m,
270 $ n,
271 $ k, -1 ) )
272 lwkopt = nw*nb + tsize
273 END IF
274 work( 1 ) = lwkopt
275 END IF
276*
277 IF( info.NE.0 ) THEN
278 CALL xerbla( 'ZUNMRZ', -info )
279 RETURN
280 ELSE IF( lquery ) THEN
281 RETURN
282 END IF
283*
284* Quick return if possible
285*
286 IF( m.EQ.0 .OR. n.EQ.0 ) THEN
287 RETURN
288 END IF
289*
290* Determine the block size. NB may be at most NBMAX, where NBMAX
291* is used to define the local array T.
292*
293 nb = min( nbmax, ilaenv( 1, 'ZUNMRQ', 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, 'ZUNMRQ', 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 zunmr3( 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 zlarzt( '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 zlarzb( 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 ) = lwkopt
378*
379 RETURN
380*
381* End of ZUNMRZ
382*
383 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine zlarzb(side, trans, direct, storev, m, n, k, l, v, ldv, t, ldt, c, ldc, work, ldwork)
ZLARZB applies a block reflector or its conjugate-transpose to a general matrix.
Definition zlarzb.f:181
subroutine zlarzt(direct, storev, n, k, v, ldv, tau, t, ldt)
ZLARZT forms the triangular factor T of a block reflector H = I - vtvH.
Definition zlarzt.f:183
subroutine zunmr3(side, trans, m, n, k, l, a, lda, tau, c, ldc, work, info)
ZUNMR3 multiplies a general matrix by the unitary matrix from a RZ factorization determined by ctzrzf...
Definition zunmr3.f:177
subroutine zunmrz(side, trans, m, n, k, l, a, lda, tau, c, ldc, work, lwork, info)
ZUNMRZ
Definition zunmrz.f:186