LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
dormrz.f
Go to the documentation of this file.
1*> \brief \b DORMRZ
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download DORMRZ + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dormrz.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dormrz.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dormrz.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE DORMRZ( 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* DOUBLE PRECISION A( LDA, * ), C( LDC, * ), TAU( * ), WORK( * )
28* ..
29*
30*
31*> \par Purpose:
32* =============
33*>
34*> \verbatim
35*>
36*> DORMRZ overwrites the general real M-by-N matrix C with
37*>
38*> SIDE = 'L' SIDE = 'R'
39*> TRANS = 'N': Q * C C * Q
40*> TRANS = 'T': Q**T * C C * Q**T
41*>
42*> where Q is a real orthogonal matrix defined as the product of k
43*> elementary reflectors
44*>
45*> Q = H(1) H(2) . . . H(k)
46*>
47*> as returned by DTZRZF. 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**T from the Left;
58*> = 'R': apply Q or Q**T from the Right.
59*> \endverbatim
60*>
61*> \param[in] TRANS
62*> \verbatim
63*> TRANS is CHARACTER*1
64*> = 'N': No transpose, apply Q;
65*> = 'T': Transpose, apply Q**T.
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 DOUBLE PRECISION 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*> DTZRZF 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 DOUBLE PRECISION array, dimension (K)
117*> TAU(i) must contain the scalar factor of the elementary
118*> reflector H(i), as returned by DTZRZF.
119*> \endverbatim
120*>
121*> \param[in,out] C
122*> \verbatim
123*> C is DOUBLE PRECISION 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 DOUBLE PRECISION 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 dormrz( 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 DOUBLE PRECISION 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 dlarzb, dlarzt, dormr3, xerbla
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, 'T' ) ) 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.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, 'DORMRQ', 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( 'DORMRZ', -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 work( 1 ) = 1
288 RETURN
289 END IF
290*
291 nbmin = 2
292 ldwork = nw
293 IF( nb.GT.1 .AND. nb.LT.k ) THEN
294 IF( lwork.LT.lwkopt ) THEN
295 nb = (lwork-tsize) / ldwork
296 nbmin = max( 2, ilaenv( 2, 'DORMRQ', side // trans, m, n,
297 $ k,
298 $ -1 ) )
299 END IF
300 END IF
301*
302 IF( nb.LT.nbmin .OR. nb.GE.k ) THEN
303*
304* Use unblocked code
305*
306 CALL dormr3( side, trans, m, n, k, l, a, lda, tau, c, ldc,
307 $ work, iinfo )
308 ELSE
309*
310* Use blocked code
311*
312 iwt = 1 + nw*nb
313 IF( ( left .AND. .NOT.notran ) .OR.
314 $ ( .NOT.left .AND. notran ) ) THEN
315 i1 = 1
316 i2 = k
317 i3 = nb
318 ELSE
319 i1 = ( ( k-1 ) / nb )*nb + 1
320 i2 = 1
321 i3 = -nb
322 END IF
323*
324 IF( left ) THEN
325 ni = n
326 jc = 1
327 ja = m - l + 1
328 ELSE
329 mi = m
330 ic = 1
331 ja = n - l + 1
332 END IF
333*
334 IF( notran ) THEN
335 transt = 'T'
336 ELSE
337 transt = 'N'
338 END IF
339*
340 DO 10 i = i1, i2, i3
341 ib = min( nb, k-i+1 )
342*
343* Form the triangular factor of the block reflector
344* H = H(i+ib-1) . . . H(i+1) H(i)
345*
346 CALL dlarzt( 'Backward', 'Rowwise', l, ib, a( i, ja ),
347 $ lda,
348 $ tau( i ), work( iwt ), ldt )
349*
350 IF( left ) THEN
351*
352* H or H**T is applied to C(i:m,1:n)
353*
354 mi = m - i + 1
355 ic = i
356 ELSE
357*
358* H or H**T is applied to C(1:m,i:n)
359*
360 ni = n - i + 1
361 jc = i
362 END IF
363*
364* Apply H or H**T
365*
366 CALL dlarzb( side, transt, 'Backward', 'Rowwise', mi, ni,
367 $ ib, l, a( i, ja ), lda, work( iwt ), ldt,
368 $ c( ic, jc ), ldc, work, ldwork )
369 10 CONTINUE
370*
371 END IF
372*
373 work( 1 ) = lwkopt
374*
375 RETURN
376*
377* End of DORMRZ
378*
379 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine dlarzb(side, trans, direct, storev, m, n, k, l, v, ldv, t, ldt, c, ldc, work, ldwork)
DLARZB applies a block reflector or its transpose to a general matrix.
Definition dlarzb.f:181
subroutine dlarzt(direct, storev, n, k, v, ldv, tau, t, ldt)
DLARZT forms the triangular factor T of a block reflector H = I - vtvH.
Definition dlarzt.f:183
subroutine dormr3(side, trans, m, n, k, l, a, lda, tau, c, ldc, work, info)
DORMR3 multiplies a general matrix by the orthogonal matrix from a RZ factorization determined by stz...
Definition dormr3.f:177
subroutine dormrz(side, trans, m, n, k, l, a, lda, tau, c, ldc, work, lwork, info)
DORMRZ
Definition dormrz.f:186