LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ slamtsqr()

subroutine slamtsqr ( character  SIDE,
character  TRANS,
integer  M,
integer  N,
integer  K,
integer  MB,
integer  NB,
real, dimension( lda, * )  A,
integer  LDA,
real, dimension( ldt, * )  T,
integer  LDT,
real, dimension(ldc, * )  C,
integer  LDC,
real, dimension( * )  WORK,
integer  LWORK,
integer  INFO 
)
Purpose:

SLAMTSQR overwrites the general real M-by-N matrix C with

SIDE = 'L' SIDE = 'R' TRANS = 'N': Q * C C * Q TRANS = 'T': Q**T * C C * Q**T where Q is a real orthogonal matrix defined as the product of blocked elementary reflectors computed by tall skinny QR factorization (DLATSQR)

Parameters
[in]SIDE
          SIDE is CHARACTER*1
          = 'L': apply Q or Q**T from the Left;
          = 'R': apply Q or Q**T from the Right.
[in]TRANS
          TRANS is CHARACTER*1
          = 'N':  No transpose, apply Q;
          = 'T':  Transpose, apply Q**T.
[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 C. M >= N >= 0.
[in]K
          K is INTEGER
          The number of elementary reflectors whose product defines
          the matrix Q.
          N >= K >= 0;
[in]MB
          MB is INTEGER
          The block size to be used in the blocked QR.
          MB > N. (must be the same as DLATSQR)
[in]NB
          NB is INTEGER
          The column block size to be used in the blocked QR.
          N >= NB >= 1.
[in]A
          A is REAL array, dimension (LDA,K)
          The i-th column must contain the vector which defines the
          blockedelementary reflector H(i), for i = 1,2,...,k, as
          returned by DLATSQR in the first k columns of
          its array argument A.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.
          If SIDE = 'L', LDA >= max(1,M);
          if SIDE = 'R', LDA >= max(1,N).
[in]T
          T is REAL array, dimension
          ( N * Number of blocks(CEIL(M-K/MB-K)),
          The blocked upper triangular block reflectors stored in compact form
          as a sequence of upper triangular blocks.  See below
          for further details.
[in]LDT
          LDT is INTEGER
          The leading dimension of the array T.  LDT >= NB.
[in,out]C
          C is REAL array, dimension (LDC,N)
          On entry, the M-by-N matrix C.
          On exit, C is overwritten by Q*C or Q**T*C or C*Q**T or C*Q.
[in]LDC
          LDC is INTEGER
          The leading dimension of the array C. LDC >= max(1,M).
[out]WORK
         (workspace) REAL array, dimension (MAX(1,LWORK))
[in]LWORK
          LWORK is INTEGER
          The dimension of the array WORK.

          If SIDE = 'L', LWORK >= max(1,N)*NB;
          if SIDE = 'R', LWORK >= max(1,MB)*NB.
          If LWORK = -1, then a workspace query is assumed; the routine
          only calculates the optimal 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 197 of file slamtsqr.f.

197 *
198 * -- LAPACK computational routine (version 3.7.1) --
199 * -- LAPACK is a software package provided by Univ. of Tennessee, --
200 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
201 * June 2017
202 *
203 * .. Scalar Arguments ..
204  CHARACTER side, trans
205  INTEGER info, lda, m, n, k, mb, nb, ldt, lwork, ldc
206 * ..
207 * .. Array Arguments ..
208  REAL a( lda, * ), work( * ), c(ldc, * ),
209  $ t( ldt, * )
210 * ..
211 *
212 * =====================================================================
213 *
214 * ..
215 * .. Local Scalars ..
216  LOGICAL left, right, tran, notran, lquery
217  INTEGER i, ii, kk, lw, ctr
218 * ..
219 * .. External Functions ..
220  LOGICAL lsame
221  EXTERNAL lsame
222 * .. External Subroutines ..
223  EXTERNAL sgemqrt, stpmqrt, xerbla
224 * ..
225 * .. Executable Statements ..
226 *
227 * Test the input arguments
228 *
229  lquery = lwork.LT.0
230  notran = lsame( trans, 'N' )
231  tran = lsame( trans, 'T' )
232  left = lsame( side, 'L' )
233  right = lsame( side, 'R' )
234  IF (left) THEN
235  lw = n * nb
236  ELSE
237  lw = mb * nb
238  END IF
239 *
240  info = 0
241  IF( .NOT.left .AND. .NOT.right ) THEN
242  info = -1
243  ELSE IF( .NOT.tran .AND. .NOT.notran ) THEN
244  info = -2
245  ELSE IF( m.LT.0 ) THEN
246  info = -3
247  ELSE IF( n.LT.0 ) THEN
248  info = -4
249  ELSE IF( k.LT.0 ) THEN
250  info = -5
251  ELSE IF( lda.LT.max( 1, k ) ) THEN
252  info = -9
253  ELSE IF( ldt.LT.max( 1, nb) ) THEN
254  info = -11
255  ELSE IF( ldc.LT.max( 1, m ) ) THEN
256  info = -13
257  ELSE IF(( lwork.LT.max(1,lw)).AND.(.NOT.lquery)) THEN
258  info = -15
259  END IF
260 *
261 * Determine the block size if it is tall skinny or short and wide
262 *
263  IF( info.EQ.0) THEN
264  work(1) = lw
265  END IF
266 *
267  IF( info.NE.0 ) THEN
268  CALL xerbla( 'SLAMTSQR', -info )
269  RETURN
270  ELSE IF (lquery) THEN
271  RETURN
272  END IF
273 *
274 * Quick return if possible
275 *
276  IF( min(m,n,k).EQ.0 ) THEN
277  RETURN
278  END IF
279 *
280  IF((mb.LE.k).OR.(mb.GE.max(m,n,k))) THEN
281  CALL sgemqrt( side, trans, m, n, k, nb, a, lda,
282  $ t, ldt, c, ldc, work, info)
283  RETURN
284  END IF
285 *
286  IF(left.AND.notran) THEN
287 *
288 * Multiply Q to the last block of C
289 *
290  kk = mod((m-k),(mb-k))
291  ctr = (m-k)/(mb-k)
292  IF (kk.GT.0) THEN
293  ii=m-kk+1
294  CALL stpmqrt('L','N',kk , n, k, 0, nb, a(ii,1), lda,
295  $ t(1,ctr*k+1),ldt , c(1,1), ldc,
296  $ c(ii,1), ldc, work, info )
297  ELSE
298  ii=m+1
299  END IF
300 *
301  DO i=ii-(mb-k),mb+1,-(mb-k)
302 *
303 * Multiply Q to the current block of C (I:I+MB,1:N)
304 *
305  ctr = ctr - 1
306  CALL stpmqrt('L','N',mb-k , n, k, 0,nb, a(i,1), lda,
307  $ t(1, ctr * k + 1), ldt, c(1,1), ldc,
308  $ c(i,1), ldc, work, info )
309 *
310  END DO
311 *
312 * Multiply Q to the first block of C (1:MB,1:N)
313 *
314  CALL sgemqrt('L','N',mb , n, k, nb, a(1,1), lda, t
315  $ ,ldt ,c(1,1), ldc, work, info )
316 *
317  ELSE IF (left.AND.tran) THEN
318 *
319 * Multiply Q to the first block of C
320 *
321  kk = mod((m-k),(mb-k))
322  ii=m-kk+1
323  ctr = 1
324  CALL sgemqrt('L','T',mb , n, k, nb, a(1,1), lda, t
325  $ ,ldt ,c(1,1), ldc, work, info )
326 *
327  DO i=mb+1,ii-mb+k,(mb-k)
328 *
329 * Multiply Q to the current block of C (I:I+MB,1:N)
330 *
331  CALL stpmqrt('L','T',mb-k , n, k, 0,nb, a(i,1), lda,
332  $ t(1,ctr * k + 1),ldt, c(1,1), ldc,
333  $ c(i,1), ldc, work, info )
334  ctr = ctr + 1
335 *
336  END DO
337  IF(ii.LE.m) THEN
338 *
339 * Multiply Q to the last block of C
340 *
341  CALL stpmqrt('L','T',kk , n, k, 0,nb, a(ii,1), lda,
342  $ t(1, ctr * k + 1), ldt, c(1,1), ldc,
343  $ c(ii,1), ldc, work, info )
344 *
345  END IF
346 *
347  ELSE IF(right.AND.tran) THEN
348 *
349 * Multiply Q to the last block of C
350 *
351  kk = mod((n-k),(mb-k))
352  ctr = (n-k)/(mb-k)
353  IF (kk.GT.0) THEN
354  ii=n-kk+1
355  CALL stpmqrt('R','T',m , kk, k, 0, nb, a(ii,1), lda,
356  $ t(1, ctr * k + 1), ldt, c(1,1), ldc,
357  $ c(1,ii), ldc, work, info )
358  ELSE
359  ii=n+1
360  END IF
361 *
362  DO i=ii-(mb-k),mb+1,-(mb-k)
363 *
364 * Multiply Q to the current block of C (1:M,I:I+MB)
365 *
366  ctr = ctr - 1
367  CALL stpmqrt('R','T',m , mb-k, k, 0,nb, a(i,1), lda,
368  $ t(1, ctr * k + 1), ldt, c(1,1), ldc,
369  $ c(1,i), ldc, work, info )
370 *
371  END DO
372 *
373 * Multiply Q to the first block of C (1:M,1:MB)
374 *
375  CALL sgemqrt('R','T',m , mb, k, nb, a(1,1), lda, t
376  $ ,ldt ,c(1,1), ldc, work, info )
377 *
378  ELSE IF (right.AND.notran) THEN
379 *
380 * Multiply Q to the first block of C
381 *
382  kk = mod((n-k),(mb-k))
383  ii=n-kk+1
384  ctr = 1
385  CALL sgemqrt('R','N', m, mb , k, nb, a(1,1), lda, t
386  $ ,ldt ,c(1,1), ldc, work, info )
387 *
388  DO i=mb+1,ii-mb+k,(mb-k)
389 *
390 * Multiply Q to the current block of C (1:M,I:I+MB)
391 *
392  CALL stpmqrt('R','N', m, mb-k, k, 0,nb, a(i,1), lda,
393  $ t(1, ctr * k + 1),ldt, c(1,1), ldc,
394  $ c(1,i), ldc, work, info )
395  ctr = ctr + 1
396 *
397  END DO
398  IF(ii.LE.n) THEN
399 *
400 * Multiply Q to the last block of C
401 *
402  CALL stpmqrt('R','N', m, kk , k, 0,nb, a(ii,1), lda,
403  $ t(1, ctr * k + 1),ldt, c(1,1), ldc,
404  $ c(1,ii), ldc, work, info )
405 *
406  END IF
407 *
408  END IF
409 *
410  work(1) = lw
411  RETURN
412 *
413 * End of SLAMTSQR
414 *
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine stpmqrt(SIDE, TRANS, M, N, K, L, NB, V, LDV, T, LDT, A, LDA, B, LDB, WORK, INFO)
STPMQRT
Definition: stpmqrt.f:218
subroutine sgemqrt(SIDE, TRANS, M, N, K, NB, V, LDV, T, LDT, C, LDC, WORK, INFO)
SGEMQRT
Definition: sgemqrt.f:170
Here is the call graph for this function:
Here is the caller graph for this function: