174 SUBROUTINE cgeqr( M, N, A, LDA, T, TSIZE, WORK, LWORK,
182 INTEGER INFO, LDA, M, N, TSIZE, LWORK
185 COMPLEX A( LDA, * ), T( * ), WORK( * )
192 LOGICAL LQUERY, LMINWS, MINT, MINW
193 INTEGER MB, NB, MINTSZ, NBLCKS, LWMIN, LWREQ
198 EXTERNAL lsame, sroundup_lwork
204 INTRINSIC max, min, mod
216 lquery = ( tsize.EQ.-1 .OR. tsize.EQ.-2 .OR.
217 $ lwork.EQ.-1 .OR. lwork.EQ.-2 )
221 IF( tsize.EQ.-2 .OR. lwork.EQ.-2 )
THEN
222 IF( tsize.NE.-1 ) mint = .true.
223 IF( lwork.NE.-1 ) minw = .true.
228 IF( min( m, n ).GT.0 )
THEN
229 mb = ilaenv( 1,
'CGEQR ',
' ', m, n, 1, -1 )
230 nb = ilaenv( 1,
'CGEQR ',
' ', m, n, 2, -1 )
235 IF( mb.GT.m .OR. mb.LE.n ) mb = m
236 IF( nb.GT.min( m, n ) .OR. nb.LT.1 ) nb = 1
238 IF( mb.GT.n .AND. m.GT.n )
THEN
239 IF( mod( m - n, mb - n ).EQ.0 )
THEN
240 nblcks = ( m - n ) / ( mb - n )
242 nblcks = ( m - n ) / ( mb - n ) + 1
251 lwreq = max( 1, n*nb )
253 IF( ( tsize.LT.max( 1, nb*n*nblcks + 5 ) .OR. lwork.LT.lwreq )
254 $ .AND. ( lwork.GE.n ) .AND. ( tsize.GE.mintsz )
255 $ .AND. ( .NOT.lquery ) )
THEN
256 IF( tsize.LT.max( 1, nb*n*nblcks + 5 ) )
THEN
261 IF( lwork.LT.lwreq )
THEN
269 ELSE IF( n.LT.0 )
THEN
271 ELSE IF( lda.LT.max( 1, m ) )
THEN
273 ELSE IF( tsize.LT.max( 1, nb*n*nblcks + 5 )
274 $ .AND. ( .NOT.lquery ) .AND. ( .NOT.lminws ) )
THEN
276 ELSE IF( ( lwork.LT.lwreq ) .AND. ( .NOT.lquery )
277 $ .AND. ( .NOT.lminws ) )
THEN
283 t( 1 ) = cmplx( mintsz )
285 t( 1 ) = cmplx( nb*n*nblcks + 5 )
290 work( 1 ) = sroundup_lwork( lwmin )
292 work( 1 ) = sroundup_lwork( lwreq )
296 CALL xerbla(
'CGEQR', -info )
298 ELSE IF( lquery )
THEN
304 IF( min( m, n ).EQ.0 )
THEN
310 IF( ( m.LE.n ) .OR. ( mb.LE.n ) .OR. ( mb.GE.m ) )
THEN
311 CALL cgeqrt( m, n, nb, a, lda, t( 6 ), nb, work, info )
313 CALL clatsqr( m, n, mb, nb, a, lda, t( 6 ), nb, work,
317 work( 1 ) = sroundup_lwork( lwreq )
subroutine cgeqr(m, n, a, lda, t, tsize, work, lwork, info)
CGEQR
subroutine clatsqr(m, n, mb, nb, a, lda, t, ldt, work, lwork, info)
CLATSQR