LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
dgemqr.f
Go to the documentation of this file.
1*> \brief \b DGEMQR
2*
3* Definition:
4* ===========
5*
6* SUBROUTINE DGEMQR( SIDE, TRANS, M, N, K, A, LDA, T,
7* $ TSIZE, C, LDC, WORK, LWORK, INFO )
8*
9*
10* .. Scalar Arguments ..
11* CHARACTER SIDE, TRANS
12* INTEGER INFO, LDA, M, N, K, LDT, TSIZE, LWORK, LDC
13* ..
14* .. Array Arguments ..
15* DOUBLE PRECISION A( LDA, * ), T( * ), C( LDC, * ), WORK( * )
16* ..
17*
18*> \par Purpose:
19* =============
20*>
21*> \verbatim
22*>
23*> DGEMQR overwrites the general real M-by-N matrix C with
24*>
25*> SIDE = 'L' SIDE = 'R'
26*> TRANS = 'N': Q * C C * Q
27*> TRANS = 'T': Q**T * C C * Q**T
28*>
29*> where Q is a real orthogonal matrix defined as the product
30*> of blocked elementary reflectors computed by tall skinny
31*> QR factorization (DGEQR)
32*>
33*> \endverbatim
34*
35* Arguments:
36* ==========
37*
38*> \param[in] SIDE
39*> \verbatim
40*> SIDE is CHARACTER*1
41*> = 'L': apply Q or Q**T from the Left;
42*> = 'R': apply Q or Q**T from the Right.
43*> \endverbatim
44*>
45*> \param[in] TRANS
46*> \verbatim
47*> TRANS is CHARACTER*1
48*> = 'N': No transpose, apply Q;
49*> = 'T': Transpose, apply Q**T.
50*> \endverbatim
51*>
52*> \param[in] M
53*> \verbatim
54*> M is INTEGER
55*> The number of rows of the matrix A. M >=0.
56*> \endverbatim
57*>
58*> \param[in] N
59*> \verbatim
60*> N is INTEGER
61*> The number of columns of the matrix C. N >= 0.
62*> \endverbatim
63*>
64*> \param[in] K
65*> \verbatim
66*> K is INTEGER
67*> The number of elementary reflectors whose product defines
68*> the matrix Q.
69*> If SIDE = 'L', M >= K >= 0;
70*> if SIDE = 'R', N >= K >= 0.
71*> \endverbatim
72*>
73*> \param[in] A
74*> \verbatim
75*> A is DOUBLE PRECISION array, dimension (LDA,K)
76*> Part of the data structure to represent Q as returned by DGEQR.
77*> \endverbatim
78*>
79*> \param[in] LDA
80*> \verbatim
81*> LDA is INTEGER
82*> The leading dimension of the array A.
83*> If SIDE = 'L', LDA >= max(1,M);
84*> if SIDE = 'R', LDA >= max(1,N).
85*> \endverbatim
86*>
87*> \param[in] T
88*> \verbatim
89*> T is DOUBLE PRECISION array, dimension (MAX(5,TSIZE)).
90*> Part of the data structure to represent Q as returned by DGEQR.
91*> \endverbatim
92*>
93*> \param[in] TSIZE
94*> \verbatim
95*> TSIZE is INTEGER
96*> The dimension of the array T. TSIZE >= 5.
97*> \endverbatim
98*>
99*> \param[in,out] C
100*> \verbatim
101*> C is DOUBLE PRECISION array, dimension (LDC,N)
102*> On entry, the M-by-N matrix C.
103*> On exit, C is overwritten by Q*C or Q**T*C or C*Q**T or C*Q.
104*> \endverbatim
105*>
106*> \param[in] LDC
107*> \verbatim
108*> LDC is INTEGER
109*> The leading dimension of the array C. LDC >= max(1,M).
110*> \endverbatim
111*>
112*> \param[out] WORK
113*> \verbatim
114*> (workspace) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
115*> On exit, if INFO = 0, WORK(1) returns the minimal LWORK.
116*> \endverbatim
117*>
118*> \param[in] LWORK
119*> \verbatim
120*> LWORK is INTEGER
121*> The dimension of the array WORK. LWORK >= 1.
122*> If LWORK = -1, then a workspace query is assumed. The routine
123*> only calculates the size of the WORK array, returns this
124*> value as WORK(1), and no error message related to WORK
125*> is issued by XERBLA.
126*> \endverbatim
127*>
128*> \param[out] INFO
129*> \verbatim
130*> INFO is INTEGER
131*> = 0: successful exit
132*> < 0: if INFO = -i, the i-th argument had an illegal value
133*> \endverbatim
134*
135* Authors:
136* ========
137*
138*> \author Univ. of Tennessee
139*> \author Univ. of California Berkeley
140*> \author Univ. of Colorado Denver
141*> \author NAG Ltd.
142*
143*> \par Further Details
144* ====================
145*>
146*> \verbatim
147*>
148*> These details are particular for this LAPACK implementation. Users should not
149*> take them for granted. These details may change in the future, and are not likely
150*> true for another LAPACK implementation. These details are relevant if one wants
151*> to try to understand the code. They are not part of the interface.
152*>
153*> In this version,
154*>
155*> T(2): row block size (MB)
156*> T(3): column block size (NB)
157*> T(6:TSIZE): data structure needed for Q, computed by
158*> DLATSQR or DGEQRT
159*>
160*> Depending on the matrix dimensions M and N, and row and column
161*> block sizes MB and NB returned by ILAENV, DGEQR will use either
162*> DLATSQR (if the matrix is tall-and-skinny) or DGEQRT to compute
163*> the QR factorization.
164*> This version of DGEMQR will use either DLAMTSQR or DGEMQRT to
165*> multiply matrix Q by another matrix.
166*> Further Details in DLATMSQR or DGEMQRT.
167*>
168*> \endverbatim
169*>
170*> \ingroup gemqr
171*>
172* =====================================================================
173 SUBROUTINE dgemqr( SIDE, TRANS, M, N, K, A, LDA, T, TSIZE,
174 $ C, LDC, WORK, LWORK, INFO )
175*
176* -- LAPACK computational routine --
177* -- LAPACK is a software package provided by Univ. of Tennessee, --
178* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
179*
180* .. Scalar Arguments ..
181 CHARACTER SIDE, TRANS
182 INTEGER INFO, LDA, M, N, K, TSIZE, LWORK, LDC
183* ..
184* .. Array Arguments ..
185 DOUBLE PRECISION A( LDA, * ), T( * ), C( LDC, * ), WORK( * )
186* ..
187*
188* =====================================================================
189*
190* ..
191* .. Local Scalars ..
192 LOGICAL LEFT, RIGHT, TRAN, NOTRAN, LQUERY
193 INTEGER MB, NB, LW, NBLCKS, MN, MINMNK, LWMIN
194* ..
195* .. External Functions ..
196 LOGICAL LSAME
197 EXTERNAL lsame
198* ..
199* .. External Subroutines ..
200 EXTERNAL dgemqrt, dlamtsqr, xerbla
201* ..
202* .. Intrinsic Functions ..
203 INTRINSIC int, max, min, mod
204* ..
205* .. Executable Statements ..
206*
207* Test the input arguments
208*
209 lquery = ( lwork.EQ.-1 )
210 notran = lsame( trans, 'N' )
211 tran = lsame( trans, 'T' )
212 left = lsame( side, 'L' )
213 right = lsame( side, 'R' )
214*
215 mb = int( t( 2 ) )
216 nb = int( t( 3 ) )
217 IF( left ) THEN
218 lw = n * nb
219 mn = m
220 ELSE
221 lw = mb * nb
222 mn = n
223 END IF
224*
225 minmnk = min( m, n, k )
226 IF( minmnk.EQ.0 ) THEN
227 lwmin = 1
228 ELSE
229 lwmin = max( 1, lw )
230 END IF
231*
232 IF( ( mb.GT.k ) .AND. ( mn.GT.k ) ) THEN
233 IF( mod( mn - k, mb - k ).EQ.0 ) THEN
234 nblcks = ( mn - k ) / ( mb - k )
235 ELSE
236 nblcks = ( mn - k ) / ( mb - k ) + 1
237 END IF
238 ELSE
239 nblcks = 1
240 END IF
241*
242 info = 0
243 IF( .NOT.left .AND. .NOT.right ) THEN
244 info = -1
245 ELSE IF( .NOT.tran .AND. .NOT.notran ) THEN
246 info = -2
247 ELSE IF( m.LT.0 ) THEN
248 info = -3
249 ELSE IF( n.LT.0 ) THEN
250 info = -4
251 ELSE IF( k.LT.0 .OR. k.GT.mn ) THEN
252 info = -5
253 ELSE IF( lda.LT.max( 1, mn ) ) THEN
254 info = -7
255 ELSE IF( tsize.LT.5 ) THEN
256 info = -9
257 ELSE IF( ldc.LT.max( 1, m ) ) THEN
258 info = -11
259 ELSE IF( lwork.LT.lwmin .AND. .NOT.lquery ) THEN
260 info = -13
261 END IF
262*
263 IF( info.EQ.0 ) THEN
264 work( 1 ) = lwmin
265 END IF
266*
267 IF( info.NE.0 ) THEN
268 CALL xerbla( 'DGEMQR', -info )
269 RETURN
270 ELSE IF( lquery ) THEN
271 RETURN
272 END IF
273*
274* Quick return if possible
275*
276 IF( minmnk.EQ.0 ) THEN
277 RETURN
278 END IF
279*
280 IF( ( left .AND. m.LE.k ) .OR. ( right .AND. n.LE.k )
281 $ .OR. ( mb.LE.k ) .OR. ( mb.GE.max( m, n, k ) ) ) THEN
282 CALL dgemqrt( side, trans, m, n, k, nb, a, lda, t( 6 ),
283 $ nb, c, ldc, work, info )
284 ELSE
285 CALL dlamtsqr( side, trans, m, n, k, mb, nb, a, lda, t( 6 ),
286 $ nb, c, ldc, work, lwork, info )
287 END IF
288*
289 work( 1 ) = lwmin
290*
291 RETURN
292*
293* End of DGEMQR
294*
295 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine dgemqr(side, trans, m, n, k, a, lda, t, tsize, c, ldc, work, lwork, info)
DGEMQR
Definition dgemqr.f:175
subroutine dgemqrt(side, trans, m, n, k, nb, v, ldv, t, ldt, c, ldc, work, info)
DGEMQRT
Definition dgemqrt.f:166
subroutine dlamtsqr(side, trans, m, n, k, mb, nb, a, lda, t, ldt, c, ldc, work, lwork, info)
DLAMTSQR
Definition dlamtsqr.f:201