LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
dormbr.f
Go to the documentation of this file.
1*> \brief \b DORMBR
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download DORMBR + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dormbr.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dormbr.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dormbr.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE DORMBR( VECT, SIDE, TRANS, M, N, K, A, LDA, TAU, C,
20* LDC, WORK, LWORK, INFO )
21*
22* .. Scalar Arguments ..
23* CHARACTER SIDE, TRANS, VECT
24* INTEGER INFO, K, 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*> If VECT = 'Q', DORMBR overwrites the general real M-by-N matrix C
37*> with
38*> SIDE = 'L' SIDE = 'R'
39*> TRANS = 'N': Q * C C * Q
40*> TRANS = 'T': Q**T * C C * Q**T
41*>
42*> If VECT = 'P', DORMBR overwrites the general real M-by-N matrix C
43*> with
44*> SIDE = 'L' SIDE = 'R'
45*> TRANS = 'N': P * C C * P
46*> TRANS = 'T': P**T * C C * P**T
47*>
48*> Here Q and P**T are the orthogonal matrices determined by DGEBRD when
49*> reducing a real matrix A to bidiagonal form: A = Q * B * P**T. Q and
50*> P**T are defined as products of elementary reflectors H(i) and G(i)
51*> respectively.
52*>
53*> Let nq = m if SIDE = 'L' and nq = n if SIDE = 'R'. Thus nq is the
54*> order of the orthogonal matrix Q or P**T that is applied.
55*>
56*> If VECT = 'Q', A is assumed to have been an NQ-by-K matrix:
57*> if nq >= k, Q = H(1) H(2) . . . H(k);
58*> if nq < k, Q = H(1) H(2) . . . H(nq-1).
59*>
60*> If VECT = 'P', A is assumed to have been a K-by-NQ matrix:
61*> if k < nq, P = G(1) G(2) . . . G(k);
62*> if k >= nq, P = G(1) G(2) . . . G(nq-1).
63*> \endverbatim
64*
65* Arguments:
66* ==========
67*
68*> \param[in] VECT
69*> \verbatim
70*> VECT is CHARACTER*1
71*> = 'Q': apply Q or Q**T;
72*> = 'P': apply P or P**T.
73*> \endverbatim
74*>
75*> \param[in] SIDE
76*> \verbatim
77*> SIDE is CHARACTER*1
78*> = 'L': apply Q, Q**T, P or P**T from the Left;
79*> = 'R': apply Q, Q**T, P or P**T from the Right.
80*> \endverbatim
81*>
82*> \param[in] TRANS
83*> \verbatim
84*> TRANS is CHARACTER*1
85*> = 'N': No transpose, apply Q or P;
86*> = 'T': Transpose, apply Q**T or P**T.
87*> \endverbatim
88*>
89*> \param[in] M
90*> \verbatim
91*> M is INTEGER
92*> The number of rows of the matrix C. M >= 0.
93*> \endverbatim
94*>
95*> \param[in] N
96*> \verbatim
97*> N is INTEGER
98*> The number of columns of the matrix C. N >= 0.
99*> \endverbatim
100*>
101*> \param[in] K
102*> \verbatim
103*> K is INTEGER
104*> If VECT = 'Q', the number of columns in the original
105*> matrix reduced by DGEBRD.
106*> If VECT = 'P', the number of rows in the original
107*> matrix reduced by DGEBRD.
108*> K >= 0.
109*> \endverbatim
110*>
111*> \param[in] A
112*> \verbatim
113*> A is DOUBLE PRECISION array, dimension
114*> (LDA,min(nq,K)) if VECT = 'Q'
115*> (LDA,nq) if VECT = 'P'
116*> The vectors which define the elementary reflectors H(i) and
117*> G(i), whose products determine the matrices Q and P, as
118*> returned by DGEBRD.
119*> \endverbatim
120*>
121*> \param[in] LDA
122*> \verbatim
123*> LDA is INTEGER
124*> The leading dimension of the array A.
125*> If VECT = 'Q', LDA >= max(1,nq);
126*> if VECT = 'P', LDA >= max(1,min(nq,K)).
127*> \endverbatim
128*>
129*> \param[in] TAU
130*> \verbatim
131*> TAU is DOUBLE PRECISION array, dimension (min(nq,K))
132*> TAU(i) must contain the scalar factor of the elementary
133*> reflector H(i) or G(i) which determines Q or P, as returned
134*> by DGEBRD in the array argument TAUQ or TAUP.
135*> \endverbatim
136*>
137*> \param[in,out] C
138*> \verbatim
139*> C is DOUBLE PRECISION array, dimension (LDC,N)
140*> On entry, the M-by-N matrix C.
141*> On exit, C is overwritten by Q*C or Q**T*C or C*Q**T or C*Q
142*> or P*C or P**T*C or C*P or C*P**T.
143*> \endverbatim
144*>
145*> \param[in] LDC
146*> \verbatim
147*> LDC is INTEGER
148*> The leading dimension of the array C. LDC >= max(1,M).
149*> \endverbatim
150*>
151*> \param[out] WORK
152*> \verbatim
153*> WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK))
154*> On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
155*> \endverbatim
156*>
157*> \param[in] LWORK
158*> \verbatim
159*> LWORK is INTEGER
160*> The dimension of the array WORK.
161*> If SIDE = 'L', LWORK >= max(1,N);
162*> if SIDE = 'R', LWORK >= max(1,M).
163*> For optimum performance LWORK >= N*NB if SIDE = 'L', and
164*> LWORK >= M*NB if SIDE = 'R', where NB is the optimal
165*> blocksize.
166*>
167*> If LWORK = -1, then a workspace query is assumed; the routine
168*> only calculates the optimal size of the WORK array, returns
169*> this value as the first entry of the WORK array, and no error
170*> message related to LWORK is issued by XERBLA.
171*> \endverbatim
172*>
173*> \param[out] INFO
174*> \verbatim
175*> INFO is INTEGER
176*> = 0: successful exit
177*> < 0: if INFO = -i, the i-th argument had an illegal value
178*> \endverbatim
179*
180* Authors:
181* ========
182*
183*> \author Univ. of Tennessee
184*> \author Univ. of California Berkeley
185*> \author Univ. of Colorado Denver
186*> \author NAG Ltd.
187*
188*> \ingroup unmbr
189*
190* =====================================================================
191 SUBROUTINE dormbr( VECT, SIDE, TRANS, M, N, K, A, LDA, TAU, C,
192 $ LDC, WORK, LWORK, INFO )
193*
194* -- LAPACK computational routine --
195* -- LAPACK is a software package provided by Univ. of Tennessee, --
196* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
197*
198* .. Scalar Arguments ..
199 CHARACTER SIDE, TRANS, VECT
200 INTEGER INFO, K, LDA, LDC, LWORK, M, N
201* ..
202* .. Array Arguments ..
203 DOUBLE PRECISION A( LDA, * ), C( LDC, * ), TAU( * ), WORK( * )
204* ..
205*
206* =====================================================================
207*
208* .. Local Scalars ..
209 LOGICAL APPLYQ, LEFT, LQUERY, NOTRAN
210 CHARACTER TRANST
211 INTEGER I1, I2, IINFO, LWKOPT, MI, NB, NI, NQ, NW
212* ..
213* .. External Functions ..
214 LOGICAL LSAME
215 INTEGER ILAENV
216 EXTERNAL lsame, ilaenv
217* ..
218* .. External Subroutines ..
219 EXTERNAL dormlq, dormqr, xerbla
220* ..
221* .. Intrinsic Functions ..
222 INTRINSIC max, min
223* ..
224* .. Executable Statements ..
225*
226* Test the input arguments
227*
228 info = 0
229 applyq = lsame( vect, 'Q' )
230 left = lsame( side, 'L' )
231 notran = lsame( trans, 'N' )
232 lquery = ( lwork.EQ.-1 )
233*
234* NQ is the order of Q or P and NW is the minimum dimension of WORK
235*
236 IF( left ) THEN
237 nq = m
238 nw = max( 1, n )
239 ELSE
240 nq = n
241 nw = max( 1, m )
242 END IF
243 IF( .NOT.applyq .AND. .NOT.lsame( vect, 'P' ) ) THEN
244 info = -1
245 ELSE IF( .NOT.left .AND. .NOT.lsame( side, 'R' ) ) THEN
246 info = -2
247 ELSE IF( .NOT.notran .AND. .NOT.lsame( trans, 'T' ) ) THEN
248 info = -3
249 ELSE IF( m.LT.0 ) THEN
250 info = -4
251 ELSE IF( n.LT.0 ) THEN
252 info = -5
253 ELSE IF( k.LT.0 ) THEN
254 info = -6
255 ELSE IF( ( applyq .AND. lda.LT.max( 1, nq ) ) .OR.
256 $ ( .NOT.applyq .AND. lda.LT.max( 1, min( nq, k ) ) ) )
257 $ THEN
258 info = -8
259 ELSE IF( ldc.LT.max( 1, m ) ) THEN
260 info = -11
261 ELSE IF( lwork.LT.nw .AND. .NOT.lquery ) THEN
262 info = -13
263 END IF
264*
265 IF( info.EQ.0 ) THEN
266 IF( applyq ) THEN
267 IF( left ) THEN
268 nb = ilaenv( 1, 'DORMQR', side // trans, m-1, n, m-1,
269 $ -1 )
270 ELSE
271 nb = ilaenv( 1, 'DORMQR', side // trans, m, n-1, n-1,
272 $ -1 )
273 END IF
274 ELSE
275 IF( left ) THEN
276 nb = ilaenv( 1, 'DORMLQ', side // trans, m-1, n, m-1,
277 $ -1 )
278 ELSE
279 nb = ilaenv( 1, 'DORMLQ', side // trans, m, n-1, n-1,
280 $ -1 )
281 END IF
282 END IF
283 lwkopt = nw*nb
284 work( 1 ) = lwkopt
285 END IF
286*
287 IF( info.NE.0 ) THEN
288 CALL xerbla( 'DORMBR', -info )
289 RETURN
290 ELSE IF( lquery ) THEN
291 RETURN
292 END IF
293*
294* Quick return if possible
295*
296 work( 1 ) = 1
297 IF( m.EQ.0 .OR. n.EQ.0 )
298 $ RETURN
299*
300 IF( applyq ) THEN
301*
302* Apply Q
303*
304 IF( nq.GE.k ) THEN
305*
306* Q was determined by a call to DGEBRD with nq >= k
307*
308 CALL dormqr( side, trans, m, n, k, a, lda, tau, c, ldc,
309 $ work, lwork, iinfo )
310 ELSE IF( nq.GT.1 ) THEN
311*
312* Q was determined by a call to DGEBRD with nq < k
313*
314 IF( left ) THEN
315 mi = m - 1
316 ni = n
317 i1 = 2
318 i2 = 1
319 ELSE
320 mi = m
321 ni = n - 1
322 i1 = 1
323 i2 = 2
324 END IF
325 CALL dormqr( side, trans, mi, ni, nq-1, a( 2, 1 ), lda,
326 $ tau,
327 $ c( i1, i2 ), ldc, work, lwork, iinfo )
328 END IF
329 ELSE
330*
331* Apply P
332*
333 IF( notran ) THEN
334 transt = 'T'
335 ELSE
336 transt = 'N'
337 END IF
338 IF( nq.GT.k ) THEN
339*
340* P was determined by a call to DGEBRD with nq > k
341*
342 CALL dormlq( side, transt, m, n, k, a, lda, tau, c, ldc,
343 $ work, lwork, iinfo )
344 ELSE IF( nq.GT.1 ) THEN
345*
346* P was determined by a call to DGEBRD with nq <= k
347*
348 IF( left ) THEN
349 mi = m - 1
350 ni = n
351 i1 = 2
352 i2 = 1
353 ELSE
354 mi = m
355 ni = n - 1
356 i1 = 1
357 i2 = 2
358 END IF
359 CALL dormlq( side, transt, mi, ni, nq-1, a( 1, 2 ), lda,
360 $ tau, c( i1, i2 ), ldc, work, lwork, iinfo )
361 END IF
362 END IF
363 work( 1 ) = lwkopt
364 RETURN
365*
366* End of DORMBR
367*
368 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine dormbr(vect, side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork, info)
DORMBR
Definition dormbr.f:193
subroutine dormlq(side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork, info)
DORMLQ
Definition dormlq.f:165
subroutine dormqr(side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork, info)
DORMQR
Definition dormqr.f:165