* F08NNF Example Program Text * Mark 21. NAG Copyright 2004. * .. Parameters .. INTEGER NIN, NOUT PARAMETER (NIN=5,NOUT=6) INTEGER NB, NMAX PARAMETER (NB=64,NMAX=10) INTEGER LDA, LDVR, LWORK PARAMETER (LDA=NMAX,LDVR=NMAX,LWORK=(1+NB)*NMAX) * .. Local Scalars .. INTEGER I, IFAIL, INFO, J, LWKOPT, N * .. Local Arrays .. COMPLEX *16 A(LDA,NMAX), DUMMY(1,1), VR(LDVR,NMAX), W(NMAX), + WORK(LWORK) DOUBLE PRECISION RWORK(2*NMAX) * .. External Subroutines .. EXTERNAL X04DAF, ZGEEV * .. Executable Statements .. WRITE (NOUT,*) 'F08NNF Example Program Results' WRITE (NOUT,*) * Skip heading in data file READ (NIN,*) READ (NIN,*) N IF (N.LE.NMAX) THEN * * Read the matrix A from data file * READ (NIN,*) ((A(I,J),J=1,N),I=1,N) * * Compute the eigenvalues and right eigenvectors of A * CALL ZGEEV('No left vectors','Vectors (right)',N,A,LDA,W,DUMMY, + 1,VR,LDVR,WORK,LWORK,RWORK,INFO) LWKOPT = WORK(1) * IF (INFO.EQ.0) THEN * * Print solution * WRITE (NOUT,*) 'Eigenvalues' WRITE (NOUT,99999) (W(J),J=1,N) * WRITE (NOUT,*) IFAIL = 0 CALL X04DAF('General',' ',N,N,VR,LDVR,'Eigenvectors',IFAIL) ELSE WRITE (NOUT,*) WRITE (NOUT,99998) 'Failure in ZGEEV. INFO = ', INFO END IF * * Print workspace information * IF (LWORK.LT.LWKOPT) THEN WRITE (NOUT,*) WRITE (NOUT,99997) 'Optimum workspace required = ', LWKOPT, + 'Workspace provided = ', LWORK END IF ELSE WRITE (NOUT,*) 'NMAX too small' END IF STOP * 99999 FORMAT ((3X,4(' (',F7.4,',',F7.4,')',:))) 99998 FORMAT (1X,A,I4) 99997 FORMAT (1X,A,I5,/1X,A,I5) END