191 SUBROUTINE cggglm( N, M, P, A, LDA, B, LDB, D, X, Y, WORK,
200 INTEGER INFO, LDA, LDB, LWORK, M, N, P
203 COMPLEX A( LDA, * ), B( LDB, * ), D( * ), WORK( * ),
211 PARAMETER ( CZERO = ( 0.0e+0, 0.0e+0 ),
212 $ cone = ( 1.0e+0, 0.0e+0 ) )
216 INTEGER I, LOPT, LWKMIN, LWKOPT, NB, NB1, NB2, NB3,
227 EXTERNAL ilaenv, sroundup_lwork
230 INTRINSIC int, max, min
238 lquery = ( lwork.EQ.-1 )
241 ELSE IF( m.LT.0 .OR. m.GT.n )
THEN
243 ELSE IF( p.LT.0 .OR. p.LT.n-m )
THEN
245 ELSE IF( lda.LT.max( 1, n ) )
THEN
247 ELSE IF( ldb.LT.max( 1, n ) )
THEN
258 nb1 = ilaenv( 1,
'CGEQRF',
' ', n, m, -1, -1 )
259 nb2 = ilaenv( 1,
'CGERQF',
' ', n, m, -1, -1 )
260 nb3 = ilaenv( 1,
'CUNMQR',
' ', n, m, p, -1 )
261 nb4 = ilaenv( 1,
'CUNMRQ',
' ', n, m, p, -1 )
262 nb = max( nb1, nb2, nb3, nb4 )
264 lwkopt = m + np + max( n, p )*nb
266 work( 1 ) = sroundup_lwork(lwkopt)
268 IF( lwork.LT.lwkmin .AND. .NOT.lquery )
THEN
274 CALL xerbla(
'CGGGLM', -info )
276 ELSE IF( lquery )
THEN
301 CALL cggqrf( n, m, p, a, lda, work, b, ldb, work( m+1 ),
302 $ work( m+np+1 ), lwork-m-np, info )
303 lopt = int( work( m+np+1 ) )
308 CALL cunmqr(
'Left',
'Conjugate transpose', n, 1, m, a, lda,
310 $ d, max( 1, n ), work( m+np+1 ), lwork-m-np, info )
311 lopt = max( lopt, int( work( m+np+1 ) ) )
316 CALL ctrtrs(
'Upper',
'No transpose',
'Non unit', n-m, 1,
317 $ b( m+1, m+p-n+1 ), ldb, d( m+1 ), n-m, info )
324 CALL ccopy( n-m, d( m+1 ), 1, y( m+p-n+1 ), 1 )
329 DO 10 i = 1, m + p - n
335 CALL cgemv(
'No transpose', m, n-m, -cone, b( 1, m+p-n+1 ),
337 $ y( m+p-n+1 ), 1, cone, d, 1 )
342 CALL ctrtrs(
'Upper',
'No Transpose',
'Non unit', m, 1, a,
353 CALL ccopy( m, d, 1, x, 1 )
358 CALL cunmrq(
'Left',
'Conjugate transpose', p, 1, np,
359 $ b( max( 1, n-p+1 ), 1 ), ldb, work( m+1 ), y,
360 $ max( 1, p ), work( m+np+1 ), lwork-m-np, info )
361 work( 1 ) = cmplx( m + np + max( lopt, int( work( m+np+1 ) ) ) )
subroutine cgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
CGEMV
subroutine cggglm(n, m, p, a, lda, b, ldb, d, x, y, work, lwork, info)
CGGGLM
subroutine cggqrf(n, m, p, a, lda, taua, b, ldb, taub, work, lwork, info)
CGGQRF
subroutine cunmqr(side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork, info)
CUNMQR
subroutine cunmrq(side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork, info)
CUNMRQ