LAPACK 3.12.1
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))
!>          On exit, if INFO = 0, WORK(1) returns the minimal LWORK.
!> 
[in]LWORK
!>          LWORK is INTEGER
!>          The dimension of the array WORK.
!>
!>          If MIN(M,N,K) = 0, LWORK >= 1.
!>          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 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:
!> 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 198 of file dlamswlq.f.

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