* F08PEF Example Program Text * Mark 16 Release. NAG Copyright 1992. * .. Parameters .. INTEGER NIN, NOUT PARAMETER (NIN=5,NOUT=6) INTEGER NMAX, LDH, LWORK, LDZ PARAMETER (NMAX=8,LDH=NMAX,LWORK=NMAX,LDZ=NMAX) * .. Local Scalars .. INTEGER I, IFAIL, INFO, J, N * .. Local Arrays .. DOUBLE PRECISION H(LDH,NMAX), WI(NMAX), WORK(LWORK), WR(NMAX), + Z(LDZ,NMAX) * .. External Subroutines .. EXTERNAL DHSEQR, X04CAF * .. Executable Statements .. WRITE (NOUT,*) 'F08PEF Example Program Results' * Skip heading in data file READ (NIN,*) READ (NIN,*) N IF (N.LE.NMAX) THEN * * Read H from data file * READ (NIN,*) ((H(I,J),J=1,N),I=1,N) * * Calculate the eigenvalues and Schur factorization of H * CALL DHSEQR('Schur form','Initialize Z',N,1,N,H,LDH,WR,WI,Z, + LDZ,WORK,LWORK,INFO) * WRITE (NOUT,*) IF (INFO.GT.0) THEN WRITE (NOUT,*) 'Failure to converge.' ELSE WRITE (NOUT,*) 'Eigenvalues' WRITE (NOUT,99999) (' (',WR(I),',',WI(I),')',I=1,N) * * Print Schur form * WRITE (NOUT,*) IFAIL = 0 * CALL X04CAF('General',' ',N,N,H,LDH,'Schur form',IFAIL) * * Print Schur vectors * WRITE (NOUT,*) IFAIL = 0 * CALL X04CAF('General',' ',N,N,Z,LDZ,'Schur vectors of H', + IFAIL) * END IF END IF STOP * 99999 FORMAT (1X,A,F8.4,A,F8.4,A) END