LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ zlatsqr()

subroutine zlatsqr ( integer m,
integer n,
integer mb,
integer nb,
complex*16, dimension( lda, * ) a,
integer lda,
complex*16, dimension( ldt, * ) t,
integer ldt,
complex*16, dimension( * ) work,
integer lwork,
integer info )

ZLATSQR

Purpose:
!>
!> ZLATSQR computes a blocked Tall-Skinny QR factorization of
!> a complex M-by-N matrix A for M >= N:
!>
!>    A = Q * ( R ),
!>            ( 0 )
!>
!> where:
!>
!>    Q is a M-by-M orthogonal matrix, stored on exit in an implicit
!>    form in the elements below the diagonal of the array A and in
!>    the elements of the array T;
!>
!>    R is an upper-triangular N-by-N matrix, stored on exit in
!>    the elements on and above the diagonal of the array A.
!>
!>    0 is a (M-N)-by-N zero matrix, and is not stored.
!>
!> 
Parameters
[in]M
!>          M is INTEGER
!>          The number of rows of the matrix A.  M >= 0.
!> 
[in]N
!>          N is INTEGER
!>          The number of columns of the matrix A. M >= N >= 0.
!> 
[in]MB
!>          MB is INTEGER
!>          The row block size to be used in the blocked QR.
!>          MB > N.
!> 
[in]NB
!>          NB is INTEGER
!>          The column block size to be used in the blocked QR.
!>          N >= NB >= 1.
!> 
[in,out]A
!>          A is COMPLEX*16 array, dimension (LDA,N)
!>          On entry, the M-by-N matrix A.
!>          On exit, the elements on and above the diagonal
!>          of the array contain the N-by-N upper triangular matrix R;
!>          the elements below the diagonal represent Q by the columns
!>          of blocked V (see Further Details).
!> 
[in]LDA
!>          LDA is INTEGER
!>          The leading dimension of the array A.  LDA >= max(1,M).
!> 
[out]T
!>          T is COMPLEX*16 array,
!>          dimension (LDT, N * Number_of_row_blocks)
!>          where Number_of_row_blocks = CEIL((M-N)/(MB-N))
!>          The blocked upper triangular block reflectors stored in compact form
!>          as a sequence of upper triangular blocks.
!>          See Further Details below.
!> 
[in]LDT
!>          LDT is INTEGER
!>          The leading dimension of the array T.  LDT >= NB.
!> 
[out]WORK
!>          (workspace) COMPLEX*16 array, dimension (MAX(1,LWORK))
!>          On exit, if INFO = 0, WORK(1) returns the minimal LWORK.
!> 
[in]LWORK
!>          LWORK is INTEGER
!>          The dimension of the array WORK.
!>          LWORK >= 1, if MIN(M,N) = 0, and LWORK >= NB*N, otherwise.
!>
!>          If LWORK = -1, then a workspace query is assumed; the routine
!>          only calculates the minimal size of the WORK array, returns
!>          this value as the first entry of the WORK array, and no error
!>          message related to LWORK is issued by XERBLA.
!> 
[out]INFO
!>          INFO is INTEGER
!>          = 0:  successful exit
!>          < 0:  if INFO = -i, the i-th argument had an illegal value
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details:
!> Tall-Skinny QR (TSQR) performs QR by a sequence of orthogonal transformations,
!> representing Q as a product of other orthogonal matrices
!>   Q = Q(1) * Q(2) * . . . * Q(k)
!> where each Q(i) zeros out subdiagonal entries of a block of MB rows of A:
!>   Q(1) zeros out the subdiagonal entries of rows 1:MB of A
!>   Q(2) zeros out the bottom MB-N rows of rows [1:N,MB+1:2*MB-N] of A
!>   Q(3) zeros out the bottom MB-N rows of rows [1:N,2*MB-N+1:3*MB-2*N] of A
!>   . . .
!>
!> Q(1) is computed by GEQRT, which represents Q(1) by Householder vectors
!> stored under the diagonal of rows 1:MB of A, and by upper triangular
!> block reflectors, stored in array T(1:LDT,1:N).
!> For more information see Further Details in GEQRT.
!>
!> Q(i) for i>1 is computed by TPQRT, which represents Q(i) by Householder vectors
!> stored in rows [(i-1)*(MB-N)+N+1:i*(MB-N)+N] of A, and by upper triangular
!> block reflectors, stored in array T(1:LDT,(i-1)*N+1:i*N).
!> The last Q(k) may use fewer rows.
!> For more information see Further Details in TPQRT.
!>
!> For more details of the overall algorithm, see the description of
!> Sequential TSQR in Section 2.2 of [1].
!>
!> [1] “Communication-Optimal Parallel and Sequential QR and LU Factorizations,”
!>     J. Demmel, L. Grigori, M. Hoemmen, J. Langou,
!>     SIAM J. Sci. Comput, vol. 34, no. 1, 2012
!> 

Definition at line 170 of file zlatsqr.f.

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*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine zgeqrt(m, n, nb, a, lda, t, ldt, work, info)
ZGEQRT
Definition zgeqrt.f:139
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
subroutine ztpqrt(m, n, l, nb, a, lda, b, ldb, t, ldt, work, info)
ZTPQRT
Definition ztpqrt.f:187
Here is the call graph for this function:
Here is the caller graph for this function: