183 SUBROUTINE zggglm( N, M, P, A, LDA, B, LDB, D, X, Y, WORK, LWORK,
191 INTEGER INFO, LDA, LDB, LWORK, M, N, P
194 COMPLEX*16 A( LDA, * ), B( LDB, * ), D( * ), WORK( * ),
201 COMPLEX*16 CZERO, CONE
202 parameter( czero = ( 0.0d+0, 0.0d+0 ),
203 $ cone = ( 1.0d+0, 0.0d+0 ) )
207 INTEGER I, LOPT, LWKMIN, LWKOPT, NB, NB1, NB2, NB3,
219 INTRINSIC int, max, min
227 lquery = ( lwork.EQ.-1 )
230 ELSE IF( m.LT.0 .OR. m.GT.n )
THEN
232 ELSE IF( p.LT.0 .OR. p.LT.n-m )
THEN
234 ELSE IF( lda.LT.max( 1, n ) )
THEN
236 ELSE IF( ldb.LT.max( 1, n ) )
THEN
247 nb1 = ilaenv( 1,
'ZGEQRF',
' ', n, m, -1, -1 )
248 nb2 = ilaenv( 1,
'ZGERQF',
' ', n, m, -1, -1 )
249 nb3 = ilaenv( 1,
'ZUNMQR',
' ', n, m, p, -1 )
250 nb4 = ilaenv( 1,
'ZUNMRQ',
' ', n, m, p, -1 )
251 nb = max( nb1, nb2, nb3, nb4 )
253 lwkopt = m + np + max( n, p )*nb
257 IF( lwork.LT.lwkmin .AND. .NOT.lquery )
THEN
263 CALL xerbla(
'ZGGGLM', -info )
265 ELSE IF( lquery )
THEN
290 CALL zggqrf( n, m, p, a, lda, work, b, ldb, work( m+1 ),
291 $ work( m+np+1 ), lwork-m-np, info )
292 lopt = int( work( m+np+1 ) )
297 CALL zunmqr(
'Left',
'Conjugate transpose', n, 1, m, a, lda, work,
298 $ d, max( 1, n ), work( m+np+1 ), lwork-m-np, info )
299 lopt = max( lopt, int( work( m+np+1 ) ) )
304 CALL ztrtrs(
'Upper',
'No transpose',
'Non unit', n-m, 1,
305 $ b( m+1, m+p-n+1 ), ldb, d( m+1 ), n-m, info )
312 CALL zcopy( n-m, d( m+1 ), 1, y( m+p-n+1 ), 1 )
317 DO 10 i = 1, m + p - n
323 CALL zgemv(
'No transpose', m, n-m, -cone, b( 1, m+p-n+1 ), ldb,
324 $ y( m+p-n+1 ), 1, cone, d, 1 )
329 CALL ztrtrs(
'Upper',
'No Transpose',
'Non unit', m, 1, a, lda,
339 CALL zcopy( m, d, 1, x, 1 )
344 CALL zunmrq(
'Left',
'Conjugate transpose', p, 1, np,
345 $ b( max( 1, n-p+1 ), 1 ), ldb, work( m+1 ), y,
346 $ max( 1, p ), work( m+np+1 ), lwork-m-np, info )
347 work( 1 ) = m + np + max( lopt, int( work( m+np+1 ) ) )
subroutine xerbla(srname, info)
subroutine zcopy(n, zx, incx, zy, incy)
ZCOPY
subroutine zgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
ZGEMV
subroutine zggglm(n, m, p, a, lda, b, ldb, d, x, y, work, lwork, info)
ZGGGLM
subroutine zggqrf(n, m, p, a, lda, taua, b, ldb, taub, work, lwork, info)
ZGGQRF
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