231 RECURSIVE SUBROUTINE claqz2( ILSCHUR, ILQ, ILZ, N, ILO, IHI, NW,
232 $ A, LDA, B, LDB, Q, LDQ, Z, LDZ, NS,
233 $ ND, ALPHA, BETA, QC, LDQC, ZC, LDZC,
234 $ WORK, LWORK, RWORK, REC, INFO )
238 LOGICAL,
INTENT( IN ) :: ilschur, ilq, ilz
239 INTEGER,
INTENT( IN ) :: n, ilo, ihi, nw, lda, ldb, ldq, ldz,
240 $ ldqc, ldzc, lwork, rec
242 COMPLEX,
INTENT( INOUT ) :: a( lda, * ), b( ldb, * ), q( ldq, * ),
243 $ z( ldz, * ), alpha( * ), beta( * )
244 INTEGER,
INTENT( OUT ) :: ns, nd, info
245 COMPLEX :: qc( ldqc, * ), zc( ldzc, * ), work( * )
250 PARAMETER ( czero = ( 0.0, 0.0 ), cone = ( 1.0, 0.0 ) )
251 REAL :: zero, one, half
252 parameter( zero = 0.0, one = 1.0, half = 0.5 )
255 INTEGER :: jw, kwtop, kwbot, istopm, istartm, k, k2, ctgexc_info,
256 $ ifst, ilst, lworkreq, qz_small_info
257 REAL :: smlnum, ulp, safmin, safmax, c1, tempr
258 COMPLEX :: s, s1, temp
268 jw = min( nw, ihi-ilo+1 )
270 IF ( kwtop .EQ. ilo )
THEN
273 s = a( kwtop, kwtop-1 )
279 CALL claqz0(
'S',
'V',
'V', jw, 1, jw, a( kwtop, kwtop ), lda,
280 $ b( kwtop, kwtop ), ldb, alpha, beta, qc, ldqc, zc,
281 $ ldzc, work, -1, rwork, rec+1, qz_small_info )
282 lworkreq = int( work( 1 ) )+2*jw**2
283 lworkreq = max( lworkreq, n*nw, 2*nw**2+n )
284 IF ( lwork .EQ.-1 )
THEN
288 ELSE IF ( lwork .LT. lworkreq )
THEN
293 CALL xerbla(
'CLAQZ2', -info )
298 safmin =
slamch(
'SAFE MINIMUM' )
300 ulp =
slamch(
'PRECISION' )
301 smlnum = safmin*( real( n )/ulp )
303 IF ( ihi .EQ. kwtop )
THEN
305 alpha( kwtop ) = a( kwtop, kwtop )
306 beta( kwtop ) = b( kwtop, kwtop )
309 IF ( abs( s ) .LE. max( smlnum, ulp*abs( a( kwtop,
313 IF ( kwtop .GT. ilo )
THEN
314 a( kwtop, kwtop-1 ) = czero
321 CALL clacpy(
'ALL', jw, jw, a( kwtop, kwtop ), lda, work, jw )
322 CALL clacpy(
'ALL', jw, jw, b( kwtop, kwtop ), ldb, work( jw**2+
326 CALL claset(
'FULL', jw, jw, czero, cone, qc, ldqc )
327 CALL claset(
'FULL', jw, jw, czero, cone, zc, ldzc )
328 CALL claqz0(
'S',
'V',
'V', jw, 1, jw, a( kwtop, kwtop ), lda,
329 $ b( kwtop, kwtop ), ldb, alpha, beta, qc, ldqc, zc,
330 $ ldzc, work( 2*jw**2+1 ), lwork-2*jw**2, rwork,
331 $ rec+1, qz_small_info )
333 IF( qz_small_info .NE. 0 )
THEN
336 ns = jw-qz_small_info
337 CALL clacpy(
'ALL', jw, jw, work, jw, a( kwtop, kwtop ), lda )
338 CALL clacpy(
'ALL', jw, jw, work( jw**2+1 ), jw, b( kwtop,
344 IF ( kwtop .EQ. ilo .OR. s .EQ. czero )
THEN
350 DO WHILE ( k .LE. jw )
352 tempr = abs( a( kwbot, kwbot ) )
353 IF( tempr .EQ. zero )
THEN
356 IF ( ( abs( s*qc( 1, kwbot-kwtop+1 ) ) ) .LE. max( ulp*
357 $ tempr, smlnum ) )
THEN
364 CALL ctgexc( .true., .true., jw, a( kwtop, kwtop ),
365 $ lda, b( kwtop, kwtop ), ldb, qc, ldqc,
366 $ zc, ldzc, ifst, ilst, ctgexc_info )
378 DO WHILE ( k .LE. ihi )
379 alpha( k ) = a( k, k )
380 beta( k ) = b( k, k )
384 IF ( kwtop .NE. ilo .AND. s .NE. czero )
THEN
386 a( kwtop:kwbot, kwtop-1 ) = a( kwtop, kwtop-1 ) *conjg( qc( 1,
388 DO k = kwbot-1, kwtop, -1
389 CALL clartg( a( k, kwtop-1 ), a( k+1, kwtop-1 ), c1, s1,
391 a( k, kwtop-1 ) = temp
392 a( k+1, kwtop-1 ) = czero
393 k2 = max( kwtop, k-1 )
394 CALL crot( ihi-k2+1, a( k, k2 ), lda, a( k+1, k2 ), lda, c1,
396 CALL crot( ihi-( k-1 )+1, b( k, k-1 ), ldb, b( k+1, k-1 ),
398 CALL crot( jw, qc( 1, k-kwtop+1 ), 1, qc( 1, k+1-kwtop+1 ),
399 $ 1, c1, conjg( s1 ) )
406 DO WHILE ( k .GE. kwtop )
410 CALL claqz1( .true., .true., k2, kwtop, kwtop+jw-1,
411 $ kwbot, a, lda, b, ldb, jw, kwtop, qc, ldqc,
412 $ jw, kwtop, zc, ldzc )
429 IF ( istopm-ihi > 0 )
THEN
430 CALL cgemm(
'C',
'N', jw, istopm-ihi, jw, cone, qc, ldqc,
431 $ a( kwtop, ihi+1 ), lda, czero, work, jw )
432 CALL clacpy(
'ALL', jw, istopm-ihi, work, jw, a( kwtop,
434 CALL cgemm(
'C',
'N', jw, istopm-ihi, jw, cone, qc, ldqc,
435 $ b( kwtop, ihi+1 ), ldb, czero, work, jw )
436 CALL clacpy(
'ALL', jw, istopm-ihi, work, jw, b( kwtop,
440 CALL cgemm(
'N',
'N', n, jw, jw, cone, q( 1, kwtop ), ldq, qc,
441 $ ldqc, czero, work, n )
442 CALL clacpy(
'ALL', n, jw, work, n, q( 1, kwtop ), ldq )
445 IF ( kwtop-1-istartm+1 > 0 )
THEN
446 CALL cgemm(
'N',
'N', kwtop-istartm, jw, jw, cone, a( istartm,
447 $ kwtop ), lda, zc, ldzc, czero, work,
449 CALL clacpy(
'ALL', kwtop-istartm, jw, work, kwtop-istartm,
450 $ a( istartm, kwtop ), lda )
451 CALL cgemm(
'N',
'N', kwtop-istartm, jw, jw, cone, b( istartm,
452 $ kwtop ), ldb, zc, ldzc, czero, work,
454 CALL clacpy(
'ALL', kwtop-istartm, jw, work, kwtop-istartm,
455 $ b( istartm, kwtop ), ldb )
458 CALL cgemm(
'N',
'N', n, jw, jw, cone, z( 1, kwtop ), ldz, zc,
459 $ ldzc, czero, work, n )
460 CALL clacpy(
'ALL', n, jw, work, n, z( 1, kwtop ), ldz )
subroutine xerbla(srname, info)
subroutine cgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
CGEMM
subroutine clacpy(uplo, m, n, a, lda, b, ldb)
CLACPY copies all or part of one two-dimensional array to another.
real function slamch(cmach)
SLAMCH
recursive subroutine claqz0(wants, wantq, wantz, n, ilo, ihi, a, lda, b, ldb, alpha, beta, q, ldq, z, ldz, work, lwork, rwork, rec, info)
CLAQZ0
subroutine claqz1(ilq, ilz, k, istartm, istopm, ihi, a, lda, b, ldb, nq, qstart, q, ldq, nz, zstart, z, ldz)
CLAQZ1
recursive subroutine claqz2(ilschur, ilq, ilz, n, ilo, ihi, nw, a, lda, b, ldb, q, ldq, z, ldz, ns, nd, alpha, beta, qc, ldqc, zc, ldzc, work, lwork, rwork, rec, info)
CLAQZ2
subroutine clartg(f, g, c, s, r)
CLARTG generates a plane rotation with real cosine and complex sine.
subroutine claset(uplo, m, n, alpha, beta, a, lda)
CLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
subroutine crot(n, cx, incx, cy, incy, c, s)
CROT applies a plane rotation with real cosine and complex sine to a pair of complex vectors.
subroutine ctgexc(wantq, wantz, n, a, lda, b, ldb, q, ldq, z, ldz, ifst, ilst, info)
CTGEXC