216 SUBROUTINE stgexc( WANTQ, WANTZ, N, A, LDA, B, LDB, Q, LDQ, Z,
217 $ LDZ, IFST, ILST, WORK, LWORK, INFO )
225 INTEGER IFST, ILST, INFO, LDA, LDB, LDQ, LDZ, LWORK, N
228 REAL A( LDA, * ), B( LDB, * ), Q( LDQ, * ),
229 $ work( * ), z( ldz, * )
236 parameter( zero = 0.0e+0 )
240 INTEGER HERE, LWMIN, NBF, NBL, NBNEXT
244 EXTERNAL sroundup_lwork
257 lquery = ( lwork.EQ.-1 )
260 ELSE IF( lda.LT.max( 1, n ) )
THEN
262 ELSE IF( ldb.LT.max( 1, n ) )
THEN
264 ELSE IF( ldq.LT.1 .OR. wantq .AND. ( ldq.LT.max( 1, n ) ) )
THEN
266 ELSE IF( ldz.LT.1 .OR. wantz .AND. ( ldz.LT.max( 1, n ) ) )
THEN
268 ELSE IF( ifst.LT.1 .OR. ifst.GT.n )
THEN
270 ELSE IF( ilst.LT.1 .OR. ilst.GT.n )
THEN
280 work(1) = real( lwmin )
282 IF (lwork.LT.lwmin .AND. .NOT.lquery)
THEN
288 CALL xerbla(
'STGEXC', -info )
290 ELSE IF( lquery )
THEN
303 IF( a( ifst, ifst-1 ).NE.zero )
308 IF( a( ifst+1, ifst ).NE.zero )
316 IF( a( ilst, ilst-1 ).NE.zero )
321 IF( a( ilst+1, ilst ).NE.zero )
327 IF( ifst.LT.ilst )
THEN
331 IF( nbf.EQ.2 .AND. nbl.EQ.1 )
333 IF( nbf.EQ.1 .AND. nbl.EQ.2 )
342 IF( nbf.EQ.1 .OR. nbf.EQ.2 )
THEN
347 IF( here+nbf+1.LE.n )
THEN
348 IF( a( here+nbf+1, here+nbf ).NE.zero )
351 CALL stgex2( wantq, wantz, n, a, lda, b, ldb, q, ldq, z,
352 $ ldz, here, nbf, nbnext, work, lwork, info )
362 IF( a( here+1, here ).EQ.zero )
372 IF( here+3.LE.n )
THEN
373 IF( a( here+3, here+2 ).NE.zero )
376 CALL stgex2( wantq, wantz, n, a, lda, b, ldb, q, ldq, z,
377 $ ldz, here+1, 1, nbnext, work, lwork, info )
382 IF( nbnext.EQ.1 )
THEN
386 CALL stgex2( wantq, wantz, n, a, lda, b, ldb, q, ldq,
388 $ ldz, here, 1, 1, work, lwork, info )
399 IF( a( here+2, here+1 ).EQ.zero )
401 IF( nbnext.EQ.2 )
THEN
405 CALL stgex2( wantq, wantz, n, a, lda, b, ldb, q,
407 $ z, ldz, here, 1, nbnext, work, lwork,
418 CALL stgex2( wantq, wantz, n, a, lda, b, ldb, q,
420 $ z, ldz, here, 1, 1, work, lwork, info )
426 CALL stgex2( wantq, wantz, n, a, lda, b, ldb, q,
428 $ z, ldz, here, 1, 1, work, lwork, info )
447 IF( nbf.EQ.1 .OR. nbf.EQ.2 )
THEN
453 IF( a( here-1, here-2 ).NE.zero )
456 CALL stgex2( wantq, wantz, n, a, lda, b, ldb, q, ldq, z,
457 $ ldz, here-nbnext, nbnext, nbf, work, lwork,
468 IF( a( here+1, here ).EQ.zero )
479 IF( a( here-1, here-2 ).NE.zero )
482 CALL stgex2( wantq, wantz, n, a, lda, b, ldb, q, ldq, z,
483 $ ldz, here-nbnext, nbnext, 1, work, lwork,
489 IF( nbnext.EQ.1 )
THEN
493 CALL stgex2( wantq, wantz, n, a, lda, b, ldb, q, ldq,
495 $ ldz, here, nbnext, 1, work, lwork, info )
505 IF( a( here, here-1 ).EQ.zero )
507 IF( nbnext.EQ.2 )
THEN
511 CALL stgex2( wantq, wantz, n, a, lda, b, ldb, q,
513 $ z, ldz, here-1, 2, 1, work, lwork, info )
523 CALL stgex2( wantq, wantz, n, a, lda, b, ldb, q,
525 $ z, ldz, here, 1, 1, work, lwork, info )
531 CALL stgex2( wantq, wantz, n, a, lda, b, ldb, q,
533 $ z, ldz, here, 1, 1, work, lwork, info )
546 work( 1 ) = sroundup_lwork(lwmin)