178 SUBROUTINE zgglse( M, N, P, A, LDA, B, LDB, C, D, X, WORK, LWORK,
186 INTEGER INFO, LDA, LDB, LWORK, M, N, P
189 COMPLEX*16 A( LDA, * ), B( LDB, * ), C( * ), D( * ),
197 parameter( cone = ( 1.0d+0, 0.0d+0 ) )
201 INTEGER LOPT, LWKMIN, LWKOPT, MN, NB, NB1, NB2, NB3,
213 INTRINSIC int, max, min
221 lquery = ( lwork.EQ.-1 )
224 ELSE IF( n.LT.0 )
THEN
226 ELSE IF( p.LT.0 .OR. p.GT.n .OR. p.LT.n-m )
THEN
228 ELSE IF( lda.LT.max( 1, m ) )
THEN
230 ELSE IF( ldb.LT.max( 1, p ) )
THEN
241 nb1 = ilaenv( 1,
'ZGEQRF',
' ', m, n, -1, -1 )
242 nb2 = ilaenv( 1,
'ZGERQF',
' ', m, n, -1, -1 )
243 nb3 = ilaenv( 1,
'ZUNMQR',
' ', m, n, p, -1 )
244 nb4 = ilaenv( 1,
'ZUNMRQ',
' ', m, n, p, -1 )
245 nb = max( nb1, nb2, nb3, nb4 )
247 lwkopt = p + mn + max( m, n )*nb
251 IF( lwork.LT.lwkmin .AND. .NOT.lquery )
THEN
257 CALL xerbla(
'ZGGLSE', -info )
259 ELSE IF( lquery )
THEN
277 CALL zggrqf( p, m, n, b, ldb, work, a, lda, work( p+1 ),
278 $ work( p+mn+1 ), lwork-p-mn, info )
279 lopt = int( work( p+mn+1 ) )
284 CALL zunmqr(
'Left',
'Conjugate Transpose', m, 1, mn, a, lda,
285 $ work( p+1 ), c, max( 1, m ), work( p+mn+1 ),
287 lopt = max( lopt, int( work( p+mn+1 ) ) )
292 CALL ztrtrs(
'Upper',
'No transpose',
'Non-unit', p, 1,
293 $ b( 1, n-p+1 ), ldb, d, p, info )
302 CALL zcopy( p, d, 1, x( n-p+1 ), 1 )
306 CALL zgemv(
'No transpose', n-p, p, -cone, a( 1, n-p+1 ), lda,
313 CALL ztrtrs(
'Upper',
'No transpose',
'Non-unit', n-p, 1,
314 $ a, lda, c, n-p, info )
323 CALL zcopy( n-p, c, 1, x, 1 )
331 $
CALL zgemv(
'No transpose', nr, n-m, -cone, a( n-p+1, m+1 ),
332 $ lda, d( nr+1 ), 1, cone, c( n-p+1 ), 1 )
337 CALL ztrmv(
'Upper',
'No transpose',
'Non unit', nr,
338 $ a( n-p+1, n-p+1 ), lda, d, 1 )
339 CALL zaxpy( nr, -cone, d, 1, c( n-p+1 ), 1 )
344 CALL zunmrq(
'Left',
'Conjugate Transpose', n, 1, p, b, ldb,
345 $ work( 1 ), x, n, work( p+mn+1 ), lwork-p-mn, info )
346 work( 1 ) = p + mn + max( lopt, int( work( p+mn+1 ) ) )
subroutine xerbla(srname, info)
subroutine zaxpy(n, za, zx, incx, zy, incy)
ZAXPY
subroutine zcopy(n, zx, incx, zy, incy)
ZCOPY
subroutine zgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
ZGEMV
subroutine zgglse(m, n, p, a, lda, b, ldb, c, d, x, work, lwork, info)
ZGGLSE solves overdetermined or underdetermined systems for OTHER matrices
subroutine zggrqf(m, p, n, a, lda, taua, b, ldb, taub, work, lwork, info)
ZGGRQF
subroutine ztrmv(uplo, trans, diag, n, a, lda, x, incx)
ZTRMV
subroutine ztrtrs(uplo, trans, diag, n, nrhs, a, lda, b, ldb, info)
ZTRTRS
subroutine zunmqr(side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork, info)
ZUNMQR
subroutine zunmrq(side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork, info)
ZUNMRQ