172 SUBROUTINE zgelq( M, N, A, LDA, T, TSIZE, WORK, LWORK,
180 INTEGER INFO, LDA, M, N, TSIZE, LWORK
183 COMPLEX*16 A( LDA, * ), T( * ), WORK( * )
190 LOGICAL LQUERY, LMINWS, MINT, MINW
191 INTEGER MB, NB, MINTSZ, NBLCKS, LWMIN, LWOPT, LWREQ
201 INTRINSIC max, min, mod
213 lquery = ( tsize.EQ.-1 .OR. tsize.EQ.-2 .OR.
214 $ lwork.EQ.-1 .OR. lwork.EQ.-2 )
218 IF( tsize.EQ.-2 .OR. lwork.EQ.-2 )
THEN
219 IF( tsize.NE.-1 ) mint = .true.
220 IF( lwork.NE.-1 ) minw = .true.
225 IF( min( m, n ).GT.0 )
THEN
226 mb = ilaenv( 1,
'ZGELQ ',
' ', m, n, 1, -1 )
227 nb = ilaenv( 1,
'ZGELQ ',
' ', m, n, 2, -1 )
232 IF( mb.GT.min( m, n ) .OR. mb.LT.1 ) mb = 1
233 IF( nb.GT.n .OR. nb.LE.m ) nb = n
235 IF ( nb.GT.m .AND. n.GT.m )
THEN
236 IF( mod( n - m, nb - m ).EQ.0 )
THEN
237 nblcks = ( n - m ) / ( nb - m )
239 nblcks = ( n - m ) / ( nb - m ) + 1
247 IF( ( n.LE.m ) .OR. ( nb.LE.m ) .OR. ( nb.GE.n ) )
THEN
249 lwopt = max( 1, mb*n )
252 lwopt = max( 1, mb*m )
255 IF( ( tsize.LT.max( 1, mb*m*nblcks + 5 ) .OR. lwork.LT.lwopt )
256 $ .AND. ( lwork.GE.lwmin ) .AND. ( tsize.GE.mintsz )
257 $ .AND. ( .NOT.lquery ) )
THEN
258 IF( tsize.LT.max( 1, mb*m*nblcks + 5 ) )
THEN
263 IF( lwork.LT.lwopt )
THEN
268 IF( ( n.LE.m ) .OR. ( nb.LE.m ) .OR. ( nb.GE.n ) )
THEN
269 lwreq = max( 1, mb*n )
271 lwreq = max( 1, mb*m )
276 ELSE IF( n.LT.0 )
THEN
278 ELSE IF( lda.LT.max( 1, m ) )
THEN
280 ELSE IF( tsize.LT.max( 1, mb*m*nblcks + 5 )
281 $ .AND. ( .NOT.lquery ) .AND. ( .NOT.lminws ) )
THEN
283 ELSE IF( ( lwork.LT.lwreq ) .and .( .NOT.lquery )
284 $ .AND. ( .NOT.lminws ) )
THEN
292 t( 1 ) = mb*m*nblcks + 5
303 CALL xerbla(
'ZGELQ', -info )
305 ELSE IF( lquery )
THEN
311 IF( min( m, n ).EQ.0 )
THEN
317 IF( ( n.LE.m ) .OR. ( nb.LE.m ) .OR. ( nb.GE.n ) )
THEN
318 CALL zgelqt( m, n, mb, a, lda, t( 6 ), mb, work, info )
320 CALL zlaswlq( m, n, mb, nb, a, lda, t( 6 ), mb, work,
subroutine xerbla(srname, info)
subroutine zgelq(m, n, a, lda, t, tsize, work, lwork, info)
ZGELQ
subroutine zgelqt(m, n, mb, a, lda, t, ldt, work, info)
ZGELQT
subroutine zlaswlq(m, n, mb, nb, a, lda, t, ldt, work, lwork, info)
ZLASWLQ