183 SUBROUTINE dggglm( N, M, P, A, LDA, B, LDB, D, X, Y, WORK, LWORK,
191 INTEGER INFO, LDA, LDB, LWORK, M, N, P
194 DOUBLE PRECISION A( LDA, * ), B( LDB, * ), D( * ), WORK( * ),
201 DOUBLE PRECISION ZERO, ONE
202 parameter( zero = 0.0d+0, one = 1.0d+0 )
206 INTEGER I, LOPT, LWKMIN, LWKOPT, NB, NB1, NB2, NB3,
218 INTRINSIC int, max, min
226 lquery = ( lwork.EQ.-1 )
229 ELSE IF( m.LT.0 .OR. m.GT.n )
THEN
231 ELSE IF( p.LT.0 .OR. p.LT.n-m )
THEN
233 ELSE IF( lda.LT.max( 1, n ) )
THEN
235 ELSE IF( ldb.LT.max( 1, n ) )
THEN
246 nb1 = ilaenv( 1,
'DGEQRF',
' ', n, m, -1, -1 )
247 nb2 = ilaenv( 1,
'DGERQF',
' ', n, m, -1, -1 )
248 nb3 = ilaenv( 1,
'DORMQR',
' ', n, m, p, -1 )
249 nb4 = ilaenv( 1,
'DORMRQ',
' ', n, m, p, -1 )
250 nb = max( nb1, nb2, nb3, nb4 )
252 lwkopt = m + np + max( n, p )*nb
256 IF( lwork.LT.lwkmin .AND. .NOT.lquery )
THEN
262 CALL xerbla(
'DGGGLM', -info )
264 ELSE IF( lquery )
THEN
289 CALL dggqrf( n, m, p, a, lda, work, b, ldb, work( m+1 ),
290 $ work( m+np+1 ), lwork-m-np, info )
291 lopt = int( work( m+np+1 ) )
296 CALL dormqr(
'Left',
'Transpose', n, 1, m, a, lda, work, d,
297 $ max( 1, n ), work( m+np+1 ), lwork-m-np, info )
298 lopt = max( lopt, int( work( m+np+1 ) ) )
303 CALL dtrtrs(
'Upper',
'No transpose',
'Non unit', n-m, 1,
304 $ b( m+1, m+p-n+1 ), ldb, d( m+1 ), n-m, info )
311 CALL dcopy( n-m, d( m+1 ), 1, y( m+p-n+1 ), 1 )
316 DO 10 i = 1, m + p - n
322 CALL dgemv(
'No transpose', m, n-m, -one, b( 1, m+p-n+1 ), ldb,
323 $ y( m+p-n+1 ), 1, one, d, 1 )
328 CALL dtrtrs(
'Upper',
'No Transpose',
'Non unit', m, 1, a, lda,
338 CALL dcopy( m, d, 1, x, 1 )
343 CALL dormrq(
'Left',
'Transpose', p, 1, np,
344 $ b( max( 1, n-p+1 ), 1 ), ldb, work( m+1 ), y,
345 $ max( 1, p ), work( m+np+1 ), lwork-m-np, info )
346 work( 1 ) = m + np + max( lopt, int( work( m+np+1 ) ) )
subroutine xerbla(srname, info)
subroutine dcopy(n, dx, incx, dy, incy)
DCOPY
subroutine dgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
DGEMV
subroutine dggglm(n, m, p, a, lda, b, ldb, d, x, y, work, lwork, info)
DGGGLM
subroutine dggqrf(n, m, p, a, lda, taua, b, ldb, taub, work, lwork, info)
DGGQRF
subroutine dtrtrs(uplo, trans, diag, n, nrhs, a, lda, b, ldb, info)
DTRTRS
subroutine dormqr(side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork, info)
DORMQR
subroutine dormrq(side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork, info)
DORMRQ