PROGRAM f08ytfe ! F08YTF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : nag_wp, x04dbf, ztgexc ! .. Implicit None Statement .. IMPLICIT NONE ! .. Parameters .. INTEGER, PARAMETER :: nin = 5, nout = 6 LOGICAL, PARAMETER :: wantq = .FALSE., wantz = .FALSE. ! .. Local Scalars .. INTEGER :: i, ifail, ifst, ilst, info, lda, & ldb, ldq, ldz, n ! .. Local Arrays .. COMPLEX (KIND=nag_wp), ALLOCATABLE :: a(:,:), b(:,:), q(:,:), z(:,:) CHARACTER (1) :: clabs(1), rlabs(1) ! .. Executable Statements .. WRITE (nout,*) 'F08YTF Example Program Results' WRITE (nout,*) FLUSH (nout) ! Skip heading in data file READ (nin,*) READ (nin,*) n ldq = 1 ldz = 1 lda = n ldb = n ALLOCATE (a(lda,n),b(ldb,n),q(ldq,1),z(ldz,1)) ! Read A and B from data file READ (nin,*) (a(i,1:n),i=1,n) READ (nin,*) (b(i,1:n),i=1,n) ! Read the row indices READ (nin,*) ifst, ilst ! Reorder the A and B ! The NAG name equivalent of ztgexc is f08ytf CALL ztgexc(wantq,wantz,n,a,lda,b,ldb,q,ldq,z,ldz,ifst,ilst,info) IF (info/=0) THEN WRITE (nout,99999) info, ilst WRITE (nout,*) FLUSH (nout) END IF ! Print reordered generalized Schur form ! ifail: behaviour on error exit ! =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft ifail = 0 CALL x04dbf('General',' ',n,n,a,lda,'Bracketed','F7.4', & 'Reordered Schur matrix A','Integer',rlabs,'Integer',clabs,80,0, & ifail) WRITE (nout,*) FLUSH (nout) ifail = 0 CALL x04dbf('General',' ',n,n,b,ldb,'Bracketed','F7.4', & 'Reordered Schur matrix B','Integer',rlabs,'Integer',clabs,80,0, & ifail) 99999 FORMAT (' Reordering could not be completed. INFO = ',I3,' ILST = ',I5) END PROGRAM f08ytfe