LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages

◆ clamtsqr()

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

CLAMTSQR

Purpose:
!> !> CLAMTSQR 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 tall skinny !> QR factorization (CLATSQR) !>
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 A. 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 block size to be used in the blocked QR. !> MB > N. (must be the same as CLATSQR) !>
[in]NB
!> NB is INTEGER !> The column block size to be used in the blocked QR. !> N >= NB >= 1. !>
[in]A
!> A is COMPLEX 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 CLATSQR 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 COMPLEX 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 COMPLEX 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 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,N*NB). !> If SIDE = 'R', LWORK >= max(1,MB*NB). !> !> 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 unitary transformations, !> representing Q as a product of other unitary 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 199 of file clamtsqr.f.

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