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

Go to the source code of this file.

Functions/Subroutines

subroutine claswlq (m, n, mb, nb, a, lda, t, ldt, work, lwork, info)
 CLASWLQ

Function/Subroutine Documentation

◆ claswlq()

subroutine claswlq ( integer m,
integer n,
integer mb,
integer nb,
complex, dimension( lda, * ) a,
integer lda,
complex, dimension( ldt, *) t,
integer ldt,
complex, dimension( * ) work,
integer lwork,
integer info )

CLASWLQ

Purpose:
!>
!> CLASWLQ computes a blocked Tall-Skinny LQ factorization of
!> a complex M-by-N matrix A for M <= N:
!>
!>    A = ( L 0 ) *  Q,
!>
!> where:
!>
!>    Q is a n-by-N orthogonal matrix, stored on exit in an implicit
!>    form in the elements above the diagonal of the array A and in
!>    the elements of the array T;
!>    L is a lower-triangular M-by-M matrix stored on exit in
!>    the elements on and below the diagonal of the array A.
!>    0 is a M-by-(N-M) zero matrix, if M < N, and is not stored.
!>
!> 
Parameters
[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 A.  N >= M >= 0.
!> 
[in]MB
!>          MB is INTEGER
!>          The row block size to be used in the blocked QR.
!>          M >= MB >= 1
!> 
[in]NB
!>          NB is INTEGER
!>          The column block size to be used in the blocked QR.
!>          NB > 0.
!> 
[in,out]A
!>          A is COMPLEX array, dimension (LDA,N)
!>          On entry, the M-by-N matrix A.
!>          On exit, the elements on and below the diagonal
!>          of the array contain the N-by-N lower triangular matrix L;
!>          the elements above the diagonal represent Q by the rows
!>          of blocked V (see Further Details).
!>
!> 
[in]LDA
!>          LDA is INTEGER
!>          The leading dimension of the array A.  LDA >= max(1,M).
!> 
[out]T
!>          T is COMPLEX array,
!>          dimension (LDT, N * Number_of_row_blocks)
!>          where Number_of_row_blocks = CEIL((N-M)/(NB-M))
!>          The blocked upper triangular block reflectors stored in compact form
!>          as a sequence of upper triangular blocks.
!>          See Further Details below.
!> 
[in]LDT
!>          LDT is INTEGER
!>          The leading dimension of the array T.  LDT >= MB.
!> 
[out]WORK
!>         (workspace) COMPLEX array, dimension (MAX(1,LWORK))
!>
!> 
[in]LWORK
!>          The dimension of the array WORK.  LWORK >= MB*M.
!>          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 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 162 of file claswlq.f.

164*
165* -- LAPACK computational routine --
166* -- LAPACK is a software package provided by Univ. of Tennessee, --
167* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd. --
168*
169* .. Scalar Arguments ..
170 INTEGER INFO, LDA, M, N, MB, NB, LWORK, LDT
171* ..
172* .. Array Arguments ..
173 COMPLEX A( LDA, * ), WORK( * ), T( LDT, *)
174* ..
175*
176* =====================================================================
177*
178* ..
179* .. Local Scalars ..
180 LOGICAL LQUERY
181 INTEGER I, II, KK, CTR
182* ..
183* .. EXTERNAL FUNCTIONS ..
184 LOGICAL LSAME
185 EXTERNAL lsame
186* .. EXTERNAL SUBROUTINES ..
187 EXTERNAL cgelqt, ctplqt, xerbla
188* .. INTRINSIC FUNCTIONS ..
189 INTRINSIC max, min, mod
190* ..
191* .. EXTERNAL FUNCTIONS ..
192 INTEGER ILAENV
193 EXTERNAL ilaenv
194* ..
195* .. EXECUTABLE STATEMENTS ..
196*
197* TEST THE INPUT ARGUMENTS
198*
199 info = 0
200*
201 lquery = ( lwork.EQ.-1 )
202*
203 IF( m.LT.0 ) THEN
204 info = -1
205 ELSE IF( n.LT.0 .OR. n.LT.m ) THEN
206 info = -2
207 ELSE IF( mb.LT.1 .OR. ( mb.GT.m .AND. m.GT.0 )) THEN
208 info = -3
209 ELSE IF( nb.LE.0 ) THEN
210 info = -4
211 ELSE IF( lda.LT.max( 1, m ) ) THEN
212 info = -6
213 ELSE IF( ldt.LT.mb ) THEN
214 info = -8
215 ELSE IF( ( lwork.LT.m*mb) .AND. (.NOT.lquery) ) THEN
216 info = -10
217 END IF
218 IF( info.EQ.0) THEN
219 work(1) = mb*m
220 END IF
221*
222 IF( info.NE.0 ) THEN
223 CALL xerbla( 'CLASWLQ', -info )
224 RETURN
225 ELSE IF (lquery) THEN
226 RETURN
227 END IF
228*
229* Quick return if possible
230*
231 IF( min(m,n).EQ.0 ) THEN
232 RETURN
233 END IF
234*
235* The LQ Decomposition
236*
237 IF((m.GE.n).OR.(nb.LE.m).OR.(nb.GE.n)) THEN
238 CALL cgelqt( m, n, mb, a, lda, t, ldt, work, info)
239 RETURN
240 END IF
241*
242 kk = mod((n-m),(nb-m))
243 ii=n-kk+1
244*
245* Compute the LQ factorization of the first block A(1:M,1:NB)
246*
247 CALL cgelqt( m, nb, mb, a(1,1), lda, t, ldt, work, info)
248 ctr = 1
249*
250 DO i = nb+1, ii-nb+m , (nb-m)
251*
252* Compute the QR factorization of the current block A(1:M,I:I+NB-M)
253*
254 CALL ctplqt( m, nb-m, 0, mb, a(1,1), lda, a( 1, i ),
255 $ lda, t(1,ctr*m+1),
256 $ ldt, work, info )
257 ctr = ctr + 1
258 END DO
259*
260* Compute the QR factorization of the last block A(1:M,II:N)
261*
262 IF (ii.LE.n) THEN
263 CALL ctplqt( m, kk, 0, mb, a(1,1), lda, a( 1, ii ),
264 $ lda, t(1,ctr*m+1), ldt,
265 $ work, info )
266 END IF
267*
268 work( 1 ) = m * mb
269 RETURN
270*
271* End of CLASWLQ
272*
integer function ilaenv(ispec, name, opts, n1, n2, n3, n4)
ILAENV
Definition ilaenv.f:162
subroutine xerbla(srname, info)
XERBLA
Definition xerbla.f:60
logical function lsame(ca, cb)
LSAME
Definition lsame.f:53
subroutine cgelqt(m, n, mb, a, lda, t, ldt, work, info)
CGELQT
Definition cgelqt.f:124
subroutine ctplqt(m, n, l, mb, a, lda, b, ldb, t, ldt, work, info)
CTPLQT
Definition ctplqt.f:174
#define min(a, b)
Definition macros.h:20
#define max(a, b)
Definition macros.h:21