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