LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
claswlq.f
Go to the documentation of this file.
1*> \brief \b CLASWLQ
2*
3* Definition:
4* ===========
5*
6* SUBROUTINE CLASWLQ( M, N, MB, NB, A, LDA, T, LDT, WORK,
7* LWORK, INFO)
8*
9* .. Scalar Arguments ..
10* INTEGER INFO, LDA, M, N, MB, NB, LDT, LWORK
11* ..
12* .. Array Arguments ..
13* COMPLEX A( LDA, * ), T( LDT, * ), WORK( * )
14* ..
15*
16*
17*> \par Purpose:
18* =============
19*>
20*> \verbatim
21*>
22*> CLASWLQ computes a blocked Tall-Skinny LQ factorization of
23*> a complex M-by-N matrix A for M <= N:
24*>
25*> A = ( L 0 ) * Q,
26*>
27*> where:
28*>
29*> Q is a n-by-N orthogonal matrix, stored on exit in an implicit
30*> form in the elements above the diagonal of the array A and in
31*> the elements of the array T;
32*> L is a lower-triangular M-by-M matrix stored on exit in
33*> the elements on and below the diagonal of the array A.
34*> 0 is a M-by-(N-M) zero matrix, if M < N, and is not stored.
35*>
36*> \endverbatim
37*
38* Arguments:
39* ==========
40*
41*> \param[in] M
42*> \verbatim
43*> M is INTEGER
44*> The number of rows of the matrix A. M >= 0.
45*> \endverbatim
46*>
47*> \param[in] N
48*> \verbatim
49*> N is INTEGER
50*> The number of columns of the matrix A. N >= M >= 0.
51*> \endverbatim
52*>
53*> \param[in] MB
54*> \verbatim
55*> MB is INTEGER
56*> The row block size to be used in the blocked QR.
57*> M >= MB >= 1
58*> \endverbatim
59*> \param[in] NB
60*> \verbatim
61*> NB is INTEGER
62*> The column block size to be used in the blocked QR.
63*> NB > 0.
64*> \endverbatim
65*>
66*> \param[in,out] A
67*> \verbatim
68*> A is COMPLEX array, dimension (LDA,N)
69*> On entry, the M-by-N matrix A.
70*> On exit, the elements on and below the diagonal
71*> of the array contain the N-by-N lower triangular matrix L;
72*> the elements above the diagonal represent Q by the rows
73*> of blocked V (see Further Details).
74*>
75*> \endverbatim
76*>
77*> \param[in] LDA
78*> \verbatim
79*> LDA is INTEGER
80*> The leading dimension of the array A. LDA >= max(1,M).
81*> \endverbatim
82*>
83*> \param[out] T
84*> \verbatim
85*> T is COMPLEX array,
86*> dimension (LDT, N * Number_of_row_blocks)
87*> where Number_of_row_blocks = CEIL((N-M)/(NB-M))
88*> The blocked upper triangular block reflectors stored in compact form
89*> as a sequence of upper triangular blocks.
90*> See Further Details below.
91*> \endverbatim
92*>
93*> \param[in] LDT
94*> \verbatim
95*> LDT is INTEGER
96*> The leading dimension of the array T. LDT >= MB.
97*> \endverbatim
98*>
99*> \param[out] WORK
100*> \verbatim
101*> (workspace) COMPLEX array, dimension (MAX(1,LWORK))
102*> On exit, if INFO = 0, WORK(1) returns the minimal LWORK.
103*> \endverbatim
104*>
105*> \param[in] LWORK
106*> \verbatim
107*> LWORK is INTEGER
108*> The dimension of the array WORK.
109*> LWORK >= 1, if MIN(M,N) = 0, and LWORK >= MB*M, otherwise.
110*>
111*> If LWORK = -1, then a workspace query is assumed; the routine
112*> only calculates the minimal size of the WORK array, returns
113*> this value as the first entry of the WORK array, and no error
114*> message related to LWORK is issued by XERBLA.
115*> \endverbatim
116*>
117*> \param[out] INFO
118*> \verbatim
119*> INFO is INTEGER
120*> = 0: successful exit
121*> < 0: if INFO = -i, the i-th argument had an illegal value
122*> \endverbatim
123*
124* Authors:
125* ========
126*
127*> \author Univ. of Tennessee
128*> \author Univ. of California Berkeley
129*> \author Univ. of Colorado Denver
130*> \author NAG Ltd.
131*
132*> \par Further Details:
133* =====================
134*>
135*> \verbatim
136*> Short-Wide LQ (SWLQ) performs LQ by a sequence of orthogonal transformations,
137*> representing Q as a product of other orthogonal matrices
138*> Q = Q(1) * Q(2) * . . . * Q(k)
139*> where each Q(i) zeros out upper diagonal entries of a block of NB rows of A:
140*> Q(1) zeros out the upper diagonal entries of rows 1:NB of A
141*> Q(2) zeros out the bottom MB-N rows of rows [1:M,NB+1:2*NB-M] of A
142*> Q(3) zeros out the bottom MB-N rows of rows [1:M,2*NB-M+1:3*NB-2*M] of A
143*> . . .
144*>
145*> Q(1) is computed by GELQT, which represents Q(1) by Householder vectors
146*> stored under the diagonal of rows 1:MB of A, and by upper triangular
147*> block reflectors, stored in array T(1:LDT,1:N).
148*> For more information see Further Details in GELQT.
149*>
150*> Q(i) for i>1 is computed by TPLQT, which represents Q(i) by Householder vectors
151*> stored in columns [(i-1)*(NB-M)+M+1:i*(NB-M)+M] of A, and by upper triangular
152*> block reflectors, stored in array T(1:LDT,(i-1)*M+1:i*M).
153*> The last Q(k) may use fewer rows.
154*> For more information see Further Details in TPQRT.
155*>
156*> For more details of the overall algorithm, see the description of
157*> Sequential TSQR in Section 2.2 of [1].
158*>
159*> [1] “Communication-Optimal Parallel and Sequential QR and LU Factorizations,”
160*> J. Demmel, L. Grigori, M. Hoemmen, J. Langou,
161*> SIAM J. Sci. Comput, vol. 34, no. 1, 2012
162*> \endverbatim
163*>
164*> \ingroup laswlq
165*>
166* =====================================================================
167 SUBROUTINE claswlq( M, N, MB, NB, A, LDA, T, LDT, WORK, LWORK,
168 $ INFO )
169*
170* -- LAPACK computational routine --
171* -- LAPACK is a software package provided by Univ. of Tennessee, --
172* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd. --
173*
174* .. Scalar Arguments ..
175 INTEGER INFO, LDA, M, N, MB, NB, LWORK, LDT
176* ..
177* .. Array Arguments ..
178 COMPLEX A( LDA, * ), WORK( * ), T( LDT, * )
179* ..
180*
181* =====================================================================
182*
183* ..
184* .. Local Scalars ..
185 LOGICAL LQUERY
186 INTEGER I, II, KK, CTR, MINMN, LWMIN
187* ..
188* .. EXTERNAL FUNCTIONS ..
189 LOGICAL LSAME
190 INTEGER ILAENV
191 REAL SROUNDUP_LWORK
192 EXTERNAL lsame, ilaenv, sroundup_lwork
193* ..
194* .. EXTERNAL SUBROUTINES ..
195 EXTERNAL cgelqt, ctplqt, xerbla
196* ..
197* .. INTRINSIC FUNCTIONS ..
198 INTRINSIC max, min, mod
199* ..
200* .. EXECUTABLE STATEMENTS ..
201*
202* TEST THE INPUT ARGUMENTS
203*
204 info = 0
205*
206 lquery = ( lwork.EQ.-1 )
207*
208 minmn = min( m, n )
209 IF( minmn.EQ.0 ) THEN
210 lwmin = 1
211 ELSE
212 lwmin = m*mb
213 END IF
214*
215 IF( m.LT.0 ) THEN
216 info = -1
217 ELSE IF( n.LT.0 .OR. n.LT.m ) THEN
218 info = -2
219 ELSE IF( mb.LT.1 .OR. ( mb.GT.m .AND. m.GT.0 ) ) THEN
220 info = -3
221 ELSE IF( nb.LE.0 ) THEN
222 info = -4
223 ELSE IF( lda.LT.max( 1, m ) ) THEN
224 info = -6
225 ELSE IF( ldt.LT.mb ) THEN
226 info = -8
227 ELSE IF( lwork.LT.lwmin .AND. (.NOT.lquery) ) THEN
228 info = -10
229 END IF
230*
231 IF( info.EQ.0 ) THEN
232 work( 1 ) = sroundup_lwork( lwmin )
233 END IF
234*
235 IF( info.NE.0 ) THEN
236 CALL xerbla( 'CLASWLQ', -info )
237 RETURN
238 ELSE IF( lquery ) THEN
239 RETURN
240 END IF
241*
242* Quick return if possible
243*
244 IF( minmn.EQ.0 ) THEN
245 RETURN
246 END IF
247*
248* The LQ Decomposition
249*
250 IF( (m.GE.n) .OR. (nb.LE.m) .OR. (nb.GE.n) ) THEN
251 CALL cgelqt( m, n, mb, a, lda, t, ldt, work, info)
252 RETURN
253 END IF
254*
255 kk = mod((n-m),(nb-m))
256 ii = n-kk+1
257*
258* Compute the LQ factorization of the first block A(1:M,1:NB)
259*
260 CALL cgelqt( m, nb, mb, a(1,1), lda, t, ldt, work, info)
261 ctr = 1
262*
263 DO i = nb+1, ii-nb+m , (nb-m)
264*
265* Compute the QR factorization of the current block A(1:M,I:I+NB-M)
266*
267 CALL ctplqt( m, nb-m, 0, mb, a(1,1), lda, a( 1, i ),
268 $ lda, t(1,ctr*m+1),
269 $ ldt, work, info )
270 ctr = ctr + 1
271 END DO
272*
273* Compute the QR factorization of the last block A(1:M,II:N)
274*
275 IF( ii.LE.n ) THEN
276 CALL ctplqt( m, kk, 0, mb, a(1,1), lda, a( 1, ii ),
277 $ lda, t(1,ctr*m+1), ldt,
278 $ work, info )
279 END IF
280*
281 work( 1 ) = sroundup_lwork( lwmin )
282 RETURN
283*
284* End of CLASWLQ
285*
286 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine cgelqt(m, n, mb, a, lda, t, ldt, work, info)
CGELQT
Definition cgelqt.f:124
subroutine claswlq(m, n, mb, nb, a, lda, t, ldt, work, lwork, info)
CLASWLQ
Definition claswlq.f:169
subroutine ctplqt(m, n, l, mb, a, lda, b, ldb, t, ldt, work, info)
CTPLQT
Definition ctplqt.f:174