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

◆ dlamswlq()

subroutine dlamswlq ( character  side,
character  trans,
integer  m,
integer  n,
integer  k,
integer  mb,
integer  nb,
double precision, dimension( lda, * )  a,
integer  lda,
double precision, dimension( ldt, * )  t,
integer  ldt,
double precision, dimension(ldc, * )  c,
integer  ldc,
double precision, dimension( * )  work,
integer  lwork,
integer  info 
)

DLAMSWLQ

Purpose:
    DLAMSWLQ 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 short wide LQ
    factorization (DLASWLQ)
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 C.  M >=0.
[in]N
          N is INTEGER
          The number of columns of the matrix C. N >= 0.
[in]K
          K is INTEGER
          The number of elementary reflectors whose product defines
          the matrix Q.
          M >= K >= 0;
[in]MB
          MB is INTEGER
          The row block size to be used in the blocked LQ.
          M >= MB >= 1
[in]NB
          NB is INTEGER
          The column block size to be used in the blocked LQ.
          NB > M.
[in]A
          A is DOUBLE PRECISION array, dimension
                               (LDA,M) if SIDE = 'L',
                               (LDA,N) if SIDE = 'R'
          The i-th row must contain the vector which defines the blocked
          elementary reflector H(i), for i = 1,2,...,k, as returned by
          DLASWLQ in the first k rows of its array argument A.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A. LDA >= max(1,K).
[in]T
          T is DOUBLE PRECISION array, dimension
          ( M * Number of blocks(CEIL(N-K/NB-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 >= MB.
[in,out]C
          C is DOUBLE PRECISION 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) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
[in]LWORK
          LWORK is INTEGER
          The dimension of the array WORK.
          If SIDE = 'L', LWORK >= max(1,NB) * MB;
          if SIDE = 'R', LWORK >= max(1,M) * MB.
          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:
 Short-Wide LQ (SWLQ) performs LQ 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 upper diagonal entries of a block of NB rows of A:
   Q(1) zeros out the upper diagonal entries of rows 1:NB of A
   Q(2) zeros out the bottom MB-N rows of rows [1:M,NB+1:2*NB-M] of A
   Q(3) zeros out the bottom MB-N rows of rows [1:M,2*NB-M+1:3*NB-2*M] of A
   . . .

 Q(1) is computed by GELQT, 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 GELQT.

 Q(i) for i>1 is computed by TPLQT, which represents Q(i) by Householder vectors
 stored in columns [(i-1)*(NB-M)+M+1:i*(NB-M)+M] of A, and by upper triangular
 block reflectors, stored in array T(1:LDT,(i-1)*M+1:i*M).
 The last Q(k) may use fewer rows.
 For more information see Further Details in TPLQT.

 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 195 of file dlamswlq.f.

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