186 SUBROUTINE dgglse( M, N, P, A, LDA, B, LDB, C, D, X, WORK,
195 INTEGER INFO, LDA, LDB, LWORK, M, N, P
198 DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( * ), D( * ),
206 PARAMETER ( ONE = 1.0d+0 )
210 INTEGER LOPT, LWKMIN, LWKOPT, MN, NB, NB1, NB2, NB3,
223 INTRINSIC int, max, min
231 lquery = ( lwork.EQ.-1 )
234 ELSE IF( n.LT.0 )
THEN
236 ELSE IF( p.LT.0 .OR. p.GT.n .OR. p.LT.n-m )
THEN
238 ELSE IF( lda.LT.max( 1, m ) )
THEN
240 ELSE IF( ldb.LT.max( 1, p ) )
THEN
251 nb1 = ilaenv( 1,
'DGEQRF',
' ', m, n, -1, -1 )
252 nb2 = ilaenv( 1,
'DGERQF',
' ', m, n, -1, -1 )
253 nb3 = ilaenv( 1,
'DORMQR',
' ', m, n, p, -1 )
254 nb4 = ilaenv( 1,
'DORMRQ',
' ', m, n, p, -1 )
255 nb = max( nb1, nb2, nb3, nb4 )
257 lwkopt = p + mn + max( m, n )*nb
261 IF( lwork.LT.lwkmin .AND. .NOT.lquery )
THEN
267 CALL xerbla(
'DGGLSE', -info )
269 ELSE IF( lquery )
THEN
287 CALL dggrqf( p, m, n, b, ldb, work, a, lda, work( p+1 ),
288 $ work( p+mn+1 ), lwork-p-mn, info )
289 lopt = int( work( p+mn+1 ) )
294 CALL dormqr(
'Left',
'Transpose', m, 1, mn, a, lda,
296 $ c, max( 1, m ), work( p+mn+1 ), lwork-p-mn, info )
297 lopt = max( lopt, int( work( p+mn+1 ) ) )
302 CALL dtrtrs(
'Upper',
'No transpose',
'Non-unit', p, 1,
303 $ b( 1, n-p+1 ), ldb, d, p, info )
312 CALL dcopy( p, d, 1, x( n-p+1 ), 1 )
316 CALL dgemv(
'No transpose', n-p, p, -one, a( 1, n-p+1 ),
324 CALL dtrtrs(
'Upper',
'No transpose',
'Non-unit', n-p, 1,
325 $ a, lda, c, n-p, info )
334 CALL dcopy( n-p, c, 1, x, 1 )
342 $
CALL dgemv(
'No transpose', nr, n-m, -one, a( n-p+1,
344 $ lda, d( nr+1 ), 1, one, c( n-p+1 ), 1 )
349 CALL dtrmv(
'Upper',
'No transpose',
'Non unit', nr,
350 $ a( n-p+1, n-p+1 ), lda, d, 1 )
351 CALL daxpy( nr, -one, d, 1, c( n-p+1 ), 1 )
356 CALL dormrq(
'Left',
'Transpose', n, 1, p, b, ldb, work( 1 ),
358 $ n, work( p+mn+1 ), lwork-p-mn, info )
359 work( 1 ) = p + mn + max( lopt, int( work( p+mn+1 ) ) )
subroutine dgglse(m, n, p, a, lda, b, ldb, c, d, x, work, lwork, info)
DGGLSE solves overdetermined or underdetermined systems for OTHER matrices
subroutine dggrqf(m, p, n, a, lda, taua, b, ldb, taub, work, lwork, info)
DGGRQF
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