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

◆ slatsqr()

subroutine slatsqr ( integer m,
integer n,
integer mb,
integer nb,
real, dimension( lda, * ) a,
integer lda,
real, dimension( ldt, * ) t,
integer ldt,
real, dimension( * ) work,
integer lwork,
integer info )

SLATSQR

Purpose:
!>
!> SLATSQR computes a blocked Tall-Skinny QR factorization of
!> a real 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 REAL 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 REAL 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) REAL 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 slatsqr.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 REAL A( LDA, * ), WORK( * ), T( LDT, * )
182* ..
183*
184* =====================================================================
185*
186* ..
187* .. Local Scalars ..
188 LOGICAL LQUERY
189 INTEGER I, II, KK, CTR, MINMN, LWMIN
190* ..
191* .. EXTERNAL FUNCTIONS ..
192 LOGICAL LSAME
193 EXTERNAL lsame
194 REAL SROUNDUP_LWORK
195 EXTERNAL sroundup_lwork
196* ..
197* .. EXTERNAL SUBROUTINES ..
198 EXTERNAL sgeqrt, stpqrt, xerbla
199* ..
200* .. INTRINSIC FUNCTIONS ..
201 INTRINSIC max, min, mod
202* ..
203* .. EXECUTABLE STATEMENTS ..
204*
205* TEST THE INPUT ARGUMENTS
206*
207 info = 0
208*
209 lquery = ( lwork.EQ.-1 )
210*
211 minmn = min( m, n )
212 IF( minmn.EQ.0 ) THEN
213 lwmin = 1
214 ELSE
215 lwmin = n*nb
216 END IF
217*
218 IF( m.LT.0 ) THEN
219 info = -1
220 ELSE IF( n.LT.0 .OR. m.LT.n ) THEN
221 info = -2
222 ELSE IF( mb.LT.1 ) THEN
223 info = -3
224 ELSE IF( nb.LT.1 .OR. ( nb.GT.n .AND. n.GT.0 ) ) THEN
225 info = -4
226 ELSE IF( lda.LT.max( 1, m ) ) THEN
227 info = -6
228 ELSE IF( ldt.LT.nb ) THEN
229 info = -8
230 ELSE IF( lwork.LT.lwmin .AND. (.NOT.lquery) ) THEN
231 info = -10
232 END IF
233*
234 IF( info.EQ.0 ) THEN
235 work( 1 ) = sroundup_lwork( lwmin )
236 END IF
237 IF( info.NE.0 ) THEN
238 CALL xerbla( 'SLATSQR', -info )
239 RETURN
240 ELSE IF( lquery ) THEN
241 RETURN
242 END IF
243*
244* Quick return if possible
245*
246 IF( minmn.EQ.0 ) THEN
247 RETURN
248 END IF
249*
250* The QR Decomposition
251*
252 IF( (mb.LE.n) .OR. (mb.GE.m) ) THEN
253 CALL sgeqrt( m, n, nb, a, lda, t, ldt, work, info )
254 RETURN
255 END IF
256 kk = mod((m-n),(mb-n))
257 ii = m-kk+1
258*
259* Compute the QR factorization of the first block A(1:MB,1:N)
260*
261 CALL sgeqrt( mb, n, nb, a(1,1), lda, t, ldt, work, info )
262*
263 ctr = 1
264 DO i = mb+1, ii-mb+n, (mb-n)
265*
266* Compute the QR factorization of the current block A(I:I+MB-N,1:N)
267*
268 CALL stpqrt( mb-n, n, 0, nb, a(1,1), lda, a( i, 1 ), lda,
269 $ t(1, ctr * n + 1),
270 $ ldt, work, info )
271 ctr = ctr + 1
272 END DO
273*
274* Compute the QR factorization of the last block A(II:M,1:N)
275*
276 IF( ii.LE.m ) THEN
277 CALL stpqrt( kk, n, 0, nb, a(1,1), lda, a( ii, 1 ), lda,
278 $ t(1, ctr * n + 1), ldt,
279 $ work, info )
280 END IF
281*
282 work( 1 ) = sroundup_lwork( lwmin )
283 RETURN
284*
285* End of SLATSQR
286*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine sgeqrt(m, n, nb, a, lda, t, ldt, work, info)
SGEQRT
Definition sgeqrt.f:139
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
real function sroundup_lwork(lwork)
SROUNDUP_LWORK
subroutine stpqrt(m, n, l, nb, a, lda, b, ldb, t, ldt, work, info)
STPQRT
Definition stpqrt.f:187
Here is the call graph for this function:
Here is the caller graph for this function: