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

◆ zlamswlq()

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

ZLAMSWLQ

Purpose:
!>
!>    ZLAMSWLQ overwrites the general complex M-by-N matrix C with
!>
!>
!>                    SIDE = 'L'     SIDE = 'R'
!>    TRANS = 'N':      Q * C          C * Q
!>    TRANS = 'C':      Q**H * C       C * Q**H
!>    where Q is a complex unitary matrix defined as the product of blocked
!>    elementary reflectors computed by short wide LQ
!>    factorization (ZLASWLQ)
!> 
Parameters
[in]SIDE
!>          SIDE is CHARACTER*1
!>          = 'L': apply Q or Q**H from the Left;
!>          = 'R': apply Q or Q**H from the Right.
!> 
[in]TRANS
!>          TRANS is CHARACTER*1
!>          = 'N':  No transpose, apply Q;
!>          = 'C':  Conjugate Transpose, apply Q**H.
!> 
[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 COMPLEX*16 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
!>          ZLASWLQ 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 COMPLEX*16 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 COMPLEX*16 array, dimension (LDC,N)
!>          On entry, the M-by-N matrix C.
!>          On exit, C is overwritten by Q*C or Q**H*C or C*Q**H or C*Q.
!> 
[in]LDC
!>          LDC is INTEGER
!>          The leading dimension of the array C. LDC >= max(1,M).
!> 
[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.
!>          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 unitary transformations,
!> representing Q as a product of other unitary 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 zlamswlq.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 COMPLEX*16 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, LW, CTR, MINMNK, LWMIN
220* ..
221* .. External Functions ..
222 LOGICAL LSAME
223 EXTERNAL lsame
224* ..
225* .. External Subroutines ..
226 EXTERNAL ztpmlqt, zgemlqt, xerbla
227* ..
228* .. Executable Statements ..
229*
230* Test the input arguments
231*
232 info = 0
233 lquery = ( lwork.EQ.-1 )
234 notran = lsame( trans, 'N' )
235 tran = lsame( trans, 'C' )
236 left = lsame( side, 'L' )
237 right = lsame( side, 'R' )
238 IF( left ) THEN
239 lw = n * mb
240 ELSE
241 lw = m * mb
242 END IF
243*
244 minmnk = min( m, n, k )
245 IF( minmnk.EQ.0 ) THEN
246 lwmin = 1
247 ELSE
248 lwmin = max( 1, lw )
249 END IF
250*
251 IF( .NOT.left .AND. .NOT.right ) THEN
252 info = -1
253 ELSE IF( .NOT.tran .AND. .NOT.notran ) THEN
254 info = -2
255 ELSE IF( k.LT.0 ) THEN
256 info = -5
257 ELSE IF( m.LT.k ) THEN
258 info = -3
259 ELSE IF( n.LT.0 ) THEN
260 info = -4
261 ELSE IF( k.LT.mb .OR. mb.LT.1 ) THEN
262 info = -6
263 ELSE IF( lda.LT.max( 1, k ) ) THEN
264 info = -9
265 ELSE IF( ldt.LT.max( 1, mb ) ) THEN
266 info = -11
267 ELSE IF( ldc.LT.max( 1, m ) ) THEN
268 info = -13
269 ELSE IF( lwork.LT.lwmin .AND. (.NOT.lquery) ) THEN
270 info = -15
271 END IF
272*
273 IF( info.EQ.0 ) THEN
274 work( 1 ) = lwmin
275 END IF
276 IF( info.NE.0 ) THEN
277 CALL xerbla( 'ZLAMSWLQ', -info )
278 RETURN
279 ELSE IF( lquery ) THEN
280 RETURN
281 END IF
282*
283* Quick return if possible
284*
285 IF( minmnk.EQ.0 ) THEN
286 RETURN
287 END IF
288*
289 IF((nb.LE.k).OR.(nb.GE.max(m,n,k))) THEN
290 CALL zgemlqt( side, trans, m, n, k, mb, a, lda,
291 $ t, ldt, c, ldc, work, info )
292 RETURN
293 END IF
294*
295 IF(left.AND.tran) THEN
296*
297* Multiply Q to the last block of C
298*
299 kk = mod((m-k),(nb-k))
300 ctr = (m-k)/(nb-k)
301*
302 IF (kk.GT.0) THEN
303 ii=m-kk+1
304 CALL ztpmlqt('L','C',kk , n, k, 0, mb, a(1,ii), lda,
305 $ t(1,ctr*k+1), ldt, c(1,1), ldc,
306 $ c(ii,1), ldc, work, info )
307 ELSE
308 ii=m+1
309 END IF
310*
311 DO i=ii-(nb-k),nb+1,-(nb-k)
312*
313* Multiply Q to the current block of C (1:M,I:I+NB)
314*
315 ctr = ctr - 1
316 CALL ztpmlqt('L','C',nb-k , n, k, 0,mb, a(1,i), lda,
317 $ t(1,ctr*k+1),ldt, c(1,1), ldc,
318 $ c(i,1), ldc, work, info )
319
320 END DO
321*
322* Multiply Q to the first block of C (1:M,1:NB)
323*
324 CALL zgemlqt('L','C',nb , n, k, mb, a(1,1), lda, t
325 $ ,ldt ,c(1,1), ldc, work, info )
326*
327 ELSE IF (left.AND.notran) THEN
328*
329* Multiply Q to the first block of C
330*
331 kk = mod((m-k),(nb-k))
332 ii=m-kk+1
333 ctr = 1
334 CALL zgemlqt('L','N',nb , n, k, mb, a(1,1), lda, t
335 $ ,ldt ,c(1,1), ldc, work, info )
336*
337 DO i=nb+1,ii-nb+k,(nb-k)
338*
339* Multiply Q to the current block of C (I:I+NB,1:N)
340*
341 CALL ztpmlqt('L','N',nb-k , n, k, 0,mb, a(1,i), lda,
342 $ t(1, ctr * k + 1), ldt, c(1,1), ldc,
343 $ c(i,1), ldc, work, info )
344 ctr = ctr + 1
345*
346 END DO
347 IF(ii.LE.m) THEN
348*
349* Multiply Q to the last block of C
350*
351 CALL ztpmlqt('L','N',kk , n, k, 0, mb, a(1,ii), lda,
352 $ t(1, ctr * k + 1), ldt, c(1,1), ldc,
353 $ c(ii,1), ldc, work, info )
354*
355 END IF
356*
357 ELSE IF(right.AND.notran) THEN
358*
359* Multiply Q to the last block of C
360*
361 kk = mod((n-k),(nb-k))
362 ctr = (n-k)/(nb-k)
363 IF (kk.GT.0) THEN
364 ii=n-kk+1
365 CALL ztpmlqt('R','N',m , kk, k, 0, mb, a(1, ii), lda,
366 $ t(1, ctr * k + 1), ldt, c(1,1), ldc,
367 $ c(1,ii), ldc, work, info )
368 ELSE
369 ii=n+1
370 END IF
371*
372 DO i=ii-(nb-k),nb+1,-(nb-k)
373*
374* Multiply Q to the current block of C (1:M,I:I+MB)
375*
376 ctr = ctr - 1
377 CALL ztpmlqt('R','N', m, nb-k, k, 0, mb, a(1, i), lda,
378 $ t(1, ctr * k + 1), ldt, c(1,1), ldc,
379 $ c(1,i), ldc, work, info )
380
381 END DO
382*
383* Multiply Q to the first block of C (1:M,1:MB)
384*
385 CALL zgemlqt('R','N',m , nb, k, mb, a(1,1), lda, t
386 $ ,ldt ,c(1,1), ldc, work, info )
387*
388 ELSE IF (right.AND.tran) THEN
389*
390* Multiply Q to the first block of C
391*
392 kk = mod((n-k),(nb-k))
393 ii=n-kk+1
394 CALL zgemlqt('R','C',m , nb, k, mb, a(1,1), lda, t
395 $ ,ldt ,c(1,1), ldc, work, info )
396 ctr = 1
397*
398 DO i=nb+1,ii-nb+k,(nb-k)
399*
400* Multiply Q to the current block of C (1:M,I:I+MB)
401*
402 CALL ztpmlqt('R','C',m , nb-k, k, 0,mb, a(1,i), lda,
403 $ t(1,ctr *k+1), ldt, c(1,1), ldc,
404 $ c(1,i), ldc, work, info )
405 ctr = ctr + 1
406*
407 END DO
408 IF(ii.LE.n) THEN
409*
410* Multiply Q to the last block of C
411*
412 CALL ztpmlqt('R','C',m , kk, k, 0,mb, a(1,ii), lda,
413 $ t(1, ctr * k + 1),ldt, c(1,1), ldc,
414 $ c(1,ii), ldc, work, info )
415*
416 END IF
417*
418 END IF
419*
420 work( 1 ) = lwmin
421 RETURN
422*
423* End of ZLAMSWLQ
424*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine zgemlqt(side, trans, m, n, k, mb, v, ldv, t, ldt, c, ldc, work, info)
ZGEMLQT
Definition zgemlqt.f:166
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
subroutine ztpmlqt(side, trans, m, n, k, l, mb, v, ldv, t, ldt, a, lda, b, ldb, work, info)
ZTPMLQT
Definition ztpmlqt.f:213
Here is the call graph for this function:
Here is the caller graph for this function: