192 SUBROUTINE zgelst( TRANS, M, N, NRHS, A, LDA, B, LDB, WORK, LWORK,
201 INTEGER INFO, LDA, LDB, LWORK, M, N, NRHS
204 COMPLEX*16 A( LDA, * ), B( LDB, * ), WORK( * )
210 DOUBLE PRECISION ZERO, ONE
211 parameter( zero = 0.0d+0, one = 1.0d+0 )
213 parameter( czero = ( 0.0d+0, 0.0d+0 ) )
217 INTEGER BROW, I, IASCL, IBSCL, J, LWOPT, MN, MNNRHS,
219 DOUBLE PRECISION ANRM, BIGNUM, BNRM, SMLNUM
222 DOUBLE PRECISION RWORK( 1 )
227 DOUBLE PRECISION DLAMCH, ZLANGE
228 EXTERNAL lsame, ilaenv, dlamch, zlange
235 INTRINSIC dble, max, min
243 lquery = ( lwork.EQ.-1 )
244 IF( .NOT.( lsame( trans,
'N' ) .OR. lsame( trans,
'C' ) ) )
THEN
246 ELSE IF( m.LT.0 )
THEN
248 ELSE IF( n.LT.0 )
THEN
250 ELSE IF( nrhs.LT.0 )
THEN
252 ELSE IF( lda.LT.max( 1, m ) )
THEN
254 ELSE IF( ldb.LT.max( 1, m, n ) )
THEN
256 ELSE IF( lwork.LT.max( 1, mn+max( mn, nrhs ) ) .AND. .NOT.lquery )
263 IF( info.EQ.0 .OR. info.EQ.-10 )
THEN
266 IF( lsame( trans,
'N' ) )
269 nb = ilaenv( 1,
'ZGELST',
' ', m, n, -1, -1 )
271 mnnrhs = max( mn, nrhs )
272 lwopt = max( 1, (mn+mnnrhs)*nb )
273 work( 1 ) = dble( lwopt )
278 CALL xerbla(
'ZGELST ', -info )
280 ELSE IF( lquery )
THEN
286 IF( min( m, n, nrhs ).EQ.0 )
THEN
287 CALL zlaset(
'Full', max( m, n ), nrhs, czero, czero, b, ldb )
288 work( 1 ) = dble( lwopt )
294 IF( nb.GT.mn ) nb = mn
300 nb = min( nb, lwork/( mn + mnnrhs ) )
304 nbmin = max( 2, ilaenv( 2,
'ZGELST',
' ', m, n, -1, -1 ) )
306 IF( nb.LT.nbmin )
THEN
312 smlnum = dlamch(
'S' ) / dlamch(
'P' )
313 bignum = one / smlnum
317 anrm = zlange(
'M', m, n, a, lda, rwork )
319 IF( anrm.GT.zero .AND. anrm.LT.smlnum )
THEN
323 CALL zlascl(
'G', 0, 0, anrm, smlnum, m, n, a, lda, info )
325 ELSE IF( anrm.GT.bignum )
THEN
329 CALL zlascl(
'G', 0, 0, anrm, bignum, m, n, a, lda, info )
331 ELSE IF( anrm.EQ.zero )
THEN
335 CALL zlaset(
'Full', max( m, n ), nrhs, czero, czero, b, ldb )
336 work( 1 ) = dble( lwopt )
343 bnrm = zlange(
'M', brow, nrhs, b, ldb, rwork )
345 IF( bnrm.GT.zero .AND. bnrm.LT.smlnum )
THEN
349 CALL zlascl(
'G', 0, 0, bnrm, smlnum, brow, nrhs, b, ldb,
352 ELSE IF( bnrm.GT.bignum )
THEN
356 CALL zlascl(
'G', 0, 0, bnrm, bignum, brow, nrhs, b, ldb,
368 CALL zgeqrt( m, n, nb, a, lda, work( 1 ), nb,
369 $ work( mn*nb+1 ), info )
381 CALL zgemqrt(
'Left',
'Conjugate transpose', m, nrhs, n, nb,
382 $ a, lda, work( 1 ), nb, b, ldb,
383 $ work( mn*nb+1 ), info )
387 CALL ztrtrs(
'Upper',
'No transpose',
'Non-unit', n, nrhs,
388 $ a, lda, b, ldb, info )
406 CALL ztrtrs(
'Upper',
'Conjugate transpose',
'Non-unit',
407 $ n, nrhs, a, lda, b, ldb, info )
426 CALL zgemqrt(
'Left',
'No transpose', m, nrhs, n, nb,
427 $ a, lda, work( 1 ), nb, b, ldb,
428 $ work( mn*nb+1 ), info )
441 CALL zgelqt( m, n, nb, a, lda, work( 1 ), nb,
442 $ work( mn*nb+1 ), info )
454 CALL ztrtrs(
'Lower',
'No transpose',
'Non-unit', m, nrhs,
455 $ a, lda, b, ldb, info )
474 CALL zgemlqt(
'Left',
'Conjugate transpose', n, nrhs, m, nb,
475 $ a, lda, work( 1 ), nb, b, ldb,
476 $ work( mn*nb+1 ), info )
490 CALL zgemlqt(
'Left',
'No transpose', n, nrhs, m, nb,
491 $ a, lda, work( 1 ), nb, b, ldb,
492 $ work( mn*nb+1), info )
496 CALL ztrtrs(
'Lower',
'Conjugate transpose',
'Non-unit',
497 $ m, nrhs, a, lda, b, ldb, info )
511 IF( iascl.EQ.1 )
THEN
512 CALL zlascl(
'G', 0, 0, anrm, smlnum, scllen, nrhs, b, ldb,
514 ELSE IF( iascl.EQ.2 )
THEN
515 CALL zlascl(
'G', 0, 0, anrm, bignum, scllen, nrhs, b, ldb,
518 IF( ibscl.EQ.1 )
THEN
519 CALL zlascl(
'G', 0, 0, smlnum, bnrm, scllen, nrhs, b, ldb,
521 ELSE IF( ibscl.EQ.2 )
THEN
522 CALL zlascl(
'G', 0, 0, bignum, bnrm, scllen, nrhs, b, ldb,
526 work( 1 ) = dble( lwopt )
subroutine xerbla(srname, info)
subroutine zgelqt(m, n, mb, a, lda, t, ldt, work, info)
ZGELQT
subroutine zgelst(trans, m, n, nrhs, a, lda, b, ldb, work, lwork, info)
ZGELST solves overdetermined or underdetermined systems for GE matrices using QR or LQ factorization ...
subroutine zgemlqt(side, trans, m, n, k, mb, v, ldv, t, ldt, c, ldc, work, info)
ZGEMLQT
subroutine zgemqrt(side, trans, m, n, k, nb, v, ldv, t, ldt, c, ldc, work, info)
ZGEMQRT
subroutine zgeqrt(m, n, nb, a, lda, t, ldt, work, info)
ZGEQRT
subroutine zlascl(type, kl, ku, cfrom, cto, m, n, a, lda, info)
ZLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
subroutine zlaset(uplo, m, n, alpha, beta, a, lda)
ZLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
subroutine ztrtrs(uplo, trans, diag, n, nrhs, a, lda, b, ldb, info)
ZTRTRS