OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
dlamtsqr.f File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine dlamtsqr (side, trans, m, n, k, mb, nb, a, lda, t, ldt, c, ldc, work, lwork, info)
 DLAMTSQR

Function/Subroutine Documentation

◆ dlamtsqr()

subroutine dlamtsqr ( 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 )

DLAMTSQR

Purpose:
!>
!>      DLAMTSQR 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. 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 DLATSQR)
!> 
[in]NB
!>          NB is INTEGER
!>          The column block size to be used in the blocked QR.
!>          N >= NB >= 1.
!> 
[in]A
!>          A is DOUBLE PRECISION 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 DOUBLE PRECISION 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 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,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 195 of file dlamtsqr.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, LW, CTR, Q
217* ..
218* .. External Functions ..
219 LOGICAL LSAME
220 EXTERNAL lsame
221* .. External Subroutines ..
222 EXTERNAL dgemqrt, dtpmqrt, 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 * NB
235 Q = M
236 ELSE
237 LW = MB * NB
238 Q = N
239 END IF
240*
241 INFO = 0
242.NOT..AND..NOT. IF( LEFT RIGHT ) THEN
243 INFO = -1
244.NOT..AND..NOT. ELSE IF( TRAN NOTRAN ) THEN
245 INFO = -2
246.LT. ELSE IF( MK ) THEN
247 INFO = -3
248.LT. ELSE IF( N0 ) THEN
249 INFO = -4
250.LT. ELSE IF( K0 ) THEN
251 INFO = -5
252.LT..OR..LT. ELSE IF( KNB NB1 ) THEN
253 INFO = -7
254.LT. ELSE IF( LDAMAX( 1, Q ) ) THEN
255 INFO = -9
256.LT. ELSE IF( LDTMAX( 1, NB) ) THEN
257 INFO = -11
258.LT. ELSE IF( LDCMAX( 1, M ) ) THEN
259 INFO = -13
260.LT..AND..NOT. ELSE IF(( LWORKMAX(1,LW))(LQUERY)) THEN
261 INFO = -15
262 END IF
263*
264* Determine the block size if it is tall skinny or short and wide
265*
266.EQ. IF( INFO0) THEN
267 WORK(1) = LW
268 END IF
269*
270.NE. IF( INFO0 ) THEN
271 CALL XERBLA( 'dlamtsqr', -INFO )
272 RETURN
273 ELSE IF (LQUERY) THEN
274 RETURN
275 END IF
276*
277* Quick return if possible
278*
279.EQ. IF( MIN(M,N,K)0 ) THEN
280 RETURN
281 END IF
282*
283.LE..OR..GE. IF((MBK)(MBMAX(M,N,K))) THEN
284 CALL DGEMQRT( SIDE, TRANS, M, N, K, NB, A, LDA,
285 $ T, LDT, C, LDC, WORK, INFO)
286 RETURN
287 END IF
288*
289.AND. IF(LEFTNOTRAN) THEN
290*
291* Multiply Q to the last block of C
292*
293 KK = MOD((M-K),(MB-K))
294 CTR = (M-K)/(MB-K)
295.GT. IF (KK0) THEN
296 II=M-KK+1
297 CALL DTPMQRT('l','n',KK , N, K, 0, NB, A(II,1), LDA,
298 $ T(1,CTR*K+1),LDT , C(1,1), LDC,
299 $ C(II,1), LDC, WORK, INFO )
300 ELSE
301 II=M+1
302 END IF
303*
304 DO I=II-(MB-K),MB+1,-(MB-K)
305*
306* Multiply Q to the current block of C (I:I+MB,1:N)
307*
308 CTR = CTR - 1
309 CALL DTPMQRT('l','n',MB-K , N, K, 0,NB, A(I,1), LDA,
310 $ T(1,CTR*K+1),LDT, C(1,1), LDC,
311 $ C(I,1), LDC, WORK, INFO )
312*
313 END DO
314*
315* Multiply Q to the first block of C (1:MB,1:N)
316*
317 CALL DGEMQRT('l','n',MB , N, K, NB, A(1,1), LDA, T
318 $ ,LDT ,C(1,1), LDC, WORK, INFO )
319*
320.AND. ELSE IF (LEFTTRAN) THEN
321*
322* Multiply Q to the first block of C
323*
324 KK = MOD((M-K),(MB-K))
325 II=M-KK+1
326 CTR = 1
327 CALL DGEMQRT('l','t',MB , N, K, NB, A(1,1), LDA, T
328 $ ,LDT ,C(1,1), LDC, WORK, INFO )
329*
330 DO I=MB+1,II-MB+K,(MB-K)
331*
332* Multiply Q to the current block of C (I:I+MB,1:N)
333*
334 CALL DTPMQRT('l','t',MB-K , N, K, 0,NB, A(I,1), LDA,
335 $ T(1,CTR * K + 1),LDT, C(1,1), LDC,
336 $ C(I,1), LDC, WORK, INFO )
337 CTR = CTR + 1
338*
339 END DO
340.LE. IF(IIM) THEN
341*
342* Multiply Q to the last block of C
343*
344 CALL DTPMQRT('l','t',KK , N, K, 0,NB, A(II,1), LDA,
345 $ T(1,CTR * K + 1), LDT, C(1,1), LDC,
346 $ C(II,1), LDC, WORK, INFO )
347*
348 END IF
349*
350.AND. ELSE IF(RIGHTTRAN) THEN
351*
352* Multiply Q to the last block of C
353*
354 KK = MOD((N-K),(MB-K))
355 CTR = (N-K)/(MB-K)
356.GT. IF (KK0) THEN
357 II=N-KK+1
358 CALL DTPMQRT('r','t',M , KK, K, 0, NB, A(II,1), LDA,
359 $ T(1,CTR*K+1), LDT, C(1,1), LDC,
360 $ C(1,II), LDC, WORK, INFO )
361 ELSE
362 II=N+1
363 END IF
364*
365 DO I=II-(MB-K),MB+1,-(MB-K)
366*
367* Multiply Q to the current block of C (1:M,I:I+MB)
368*
369 CTR = CTR - 1
370 CALL DTPMQRT('r','t',M , MB-K, K, 0,NB, A(I,1), LDA,
371 $ T(1,CTR*K+1), LDT, C(1,1), LDC,
372 $ C(1,I), LDC, WORK, INFO )
373*
374 END DO
375*
376* Multiply Q to the first block of C (1:M,1:MB)
377*
378 CALL DGEMQRT('r','t',M , MB, K, NB, A(1,1), LDA, T
379 $ ,LDT ,C(1,1), LDC, WORK, INFO )
380*
381.AND. ELSE IF (RIGHTNOTRAN) THEN
382*
383* Multiply Q to the first block of C
384*
385 KK = MOD((N-K),(MB-K))
386 II=N-KK+1
387 CTR = 1
388 CALL DGEMQRT('r','n', M, MB , K, NB, A(1,1), LDA, T
389 $ ,LDT ,C(1,1), LDC, WORK, INFO )
390*
391 DO I=MB+1,II-MB+K,(MB-K)
392*
393* Multiply Q to the current block of C (1:M,I:I+MB)
394*
395 CALL DTPMQRT('r','n', M, MB-K, K, 0,NB, A(I,1), LDA,
396 $ T(1, CTR * K + 1),LDT, C(1,1), LDC,
397 $ C(1,I), LDC, WORK, INFO )
398 CTR = CTR + 1
399*
400 END DO
401.LE. IF(IIN) THEN
402*
403* Multiply Q to the last block of C
404*
405 CALL DTPMQRT('r','n', M, KK , K, 0,NB, A(II,1), LDA,
406 $ T(1, CTR * K + 1),LDT, C(1,1), LDC,
407 $ C(1,II), LDC, WORK, INFO )
408*
409 END IF
410*
411 END IF
412*
413 WORK(1) = LW
414 RETURN
415*
416* End of DLAMTSQR
417*
subroutine dlamtsqr(side, trans, m, n, k, mb, nb, a, lda, t, ldt, c, ldc, work, lwork, info)
DLAMTSQR
Definition dlamtsqr.f:197
subroutine xerbla(srname, info)
XERBLA
Definition xerbla.f:60
logical function lsame(ca, cb)
LSAME
Definition lsame.f:53
subroutine dgemqrt(side, trans, m, n, k, nb, v, ldv, t, ldt, c, ldc, work, info)
DGEMQRT
Definition dgemqrt.f:168
subroutine dtpmqrt(side, trans, m, n, k, l, nb, v, ldv, t, ldt, a, lda, b, ldb, work, info)
DTPMQRT
Definition dtpmqrt.f:216