230 RECURSIVE SUBROUTINE zlaqz2( ILSCHUR, ILQ, ILZ, N, ILO, IHI, NW,
231 $ A, LDA, B, LDB, Q, LDQ, Z, LDZ, NS,
232 $ ND, ALPHA, BETA, QC, LDQC, ZC, LDZC,
233 $ WORK, LWORK, RWORK, REC, INFO )
237 LOGICAL,
INTENT( IN ) :: ilschur, ilq, ilz
238 INTEGER,
INTENT( IN ) :: n, ilo, ihi, nw, lda, ldb, ldq, ldz,
239 $ ldqc, ldzc, lwork, rec
241 COMPLEX*16,
INTENT( INOUT ) :: a( lda, * ), b( ldb, * ), q( ldq,
242 $ * ), z( ldz, * ), alpha( * ), beta( * )
243 INTEGER,
INTENT( OUT ) :: ns, nd, info
244 COMPLEX*16 :: qc( ldqc, * ), zc( ldzc, * ), work( * )
245 DOUBLE PRECISION :: rwork( * )
248 COMPLEX*16 czero, cone
249 PARAMETER ( czero = ( 0.0d+0, 0.0d+0 ), cone = ( 1.0d+0,
251 DOUBLE PRECISION :: zero, one, half
252 parameter( zero = 0.0d0, one = 1.0d0, half = 0.5d0 )
255 INTEGER :: jw, kwtop, kwbot, istopm, istartm, k, k2, ztgexc_info,
256 $ ifst, ilst, lworkreq, qz_small_info
257 DOUBLE PRECISION ::smlnum, ulp, safmin, safmax, c1, tempr
258 COMPLEX*16 :: s, s1, temp
263 DOUBLE PRECISION,
EXTERNAL ::
dlamch
268 jw = min( nw, ihi-ilo+1 )
270 IF ( kwtop .EQ. ilo )
THEN
273 s = a( kwtop, kwtop-1 )
279 CALL zlaqz0(
'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(
'ZLAQZ2', -info )
298 safmin =
dlamch(
'SAFE MINIMUM' )
300 ulp =
dlamch(
'PRECISION' )
301 smlnum = safmin*( dble( 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 zlacpy(
'ALL', jw, jw, a( kwtop, kwtop ), lda, work, jw )
322 CALL zlacpy(
'ALL', jw, jw, b( kwtop, kwtop ), ldb, work( jw**2+
326 CALL zlaset(
'FULL', jw, jw, czero, cone, qc, ldqc )
327 CALL zlaset(
'FULL', jw, jw, czero, cone, zc, ldzc )
328 CALL zlaqz0(
'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 zlacpy(
'ALL', jw, jw, work, jw, a( kwtop, kwtop ), lda )
338 CALL zlacpy(
'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 ztgexc( .true., .true., jw, a( kwtop, kwtop ),
365 $ lda, b( kwtop, kwtop ), ldb, qc, ldqc,
366 $ zc, ldzc, ifst, ilst, ztgexc_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 ) *dconjg( qc( 1,
388 DO k = kwbot-1, kwtop, -1
389 CALL zlartg( 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 zrot( ihi-k2+1, a( k, k2 ), lda, a( k+1, k2 ), lda, c1,
396 CALL zrot( ihi-( k-1 )+1, b( k, k-1 ), ldb, b( k+1, k-1 ),
398 CALL zrot( jw, qc( 1, k-kwtop+1 ), 1, qc( 1, k+1-kwtop+1 ),
399 $ 1, c1, dconjg( s1 ) )
406 DO WHILE ( k .GE. kwtop )
410 CALL zlaqz1( .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 zgemm(
'C',
'N', jw, istopm-ihi, jw, cone, qc, ldqc,
431 $ a( kwtop, ihi+1 ), lda, czero, work, jw )
432 CALL zlacpy(
'ALL', jw, istopm-ihi, work, jw, a( kwtop,
434 CALL zgemm(
'C',
'N', jw, istopm-ihi, jw, cone, qc, ldqc,
435 $ b( kwtop, ihi+1 ), ldb, czero, work, jw )
436 CALL zlacpy(
'ALL', jw, istopm-ihi, work, jw, b( kwtop,
440 CALL zgemm(
'N',
'N', n, jw, jw, cone, q( 1, kwtop ), ldq, qc,
441 $ ldqc, czero, work, n )
442 CALL zlacpy(
'ALL', n, jw, work, n, q( 1, kwtop ), ldq )
445 IF ( kwtop-1-istartm+1 > 0 )
THEN
446 CALL zgemm(
'N',
'N', kwtop-istartm, jw, jw, cone, a( istartm,
447 $ kwtop ), lda, zc, ldzc, czero, work,
449 CALL zlacpy(
'ALL', kwtop-istartm, jw, work, kwtop-istartm,
450 $ a( istartm, kwtop ), lda )
451 CALL zgemm(
'N',
'N', kwtop-istartm, jw, jw, cone, b( istartm,
452 $ kwtop ), ldb, zc, ldzc, czero, work,
454 CALL zlacpy(
'ALL', kwtop-istartm, jw, work, kwtop-istartm,
455 $ b( istartm, kwtop ), ldb )
458 CALL zgemm(
'N',
'N', n, jw, jw, cone, z( 1, kwtop ), ldz, zc,
459 $ ldzc, czero, work, n )
460 CALL zlacpy(
'ALL', n, jw, work, n, z( 1, kwtop ), ldz )
subroutine xerbla(srname, info)
subroutine zgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
ZGEMM
subroutine zlacpy(uplo, m, n, a, lda, b, ldb)
ZLACPY copies all or part of one two-dimensional array to another.
double precision function dlamch(cmach)
DLAMCH
recursive subroutine zlaqz0(wants, wantq, wantz, n, ilo, ihi, a, lda, b, ldb, alpha, beta, q, ldq, z, ldz, work, lwork, rwork, rec, info)
ZLAQZ0
subroutine zlaqz1(ilq, ilz, k, istartm, istopm, ihi, a, lda, b, ldb, nq, qstart, q, ldq, nz, zstart, z, ldz)
ZLAQZ1
recursive subroutine zlaqz2(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)
ZLAQZ2
subroutine zlartg(f, g, c, s, r)
ZLARTG generates a plane rotation with real cosine and complex sine.
subroutine zlaset(uplo, m, n, alpha, beta, a, lda)
ZLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
subroutine zrot(n, cx, incx, cy, incy, c, s)
ZROT applies a plane rotation with real cosine and complex sine to a pair of complex vectors.
subroutine ztgexc(wantq, wantz, n, a, lda, b, ldb, q, ldq, z, ldz, ifst, ilst, info)
ZTGEXC