* F08JLF Example Program Text * Mark 21 Release. NAG Copyright 2004. * .. Parameters .. INTEGER NIN, NOUT PARAMETER (NIN=5,NOUT=6) INTEGER NMAX PARAMETER (NMAX=10) INTEGER LDZ, LIWORK, LWORK PARAMETER (LDZ=NMAX,LIWORK=10*NMAX,LWORK=18*NMAX) INTEGER IL, IU PARAMETER (IL=0,IU=0) DOUBLE PRECISION VL, VU PARAMETER (VL=0.0D0,VU=0.0D0) CHARACTER RANGE PARAMETER (RANGE='A') * .. Local Scalars .. DOUBLE PRECISION ABSTOL INTEGER I, IFAIL, INFO, M, N CHARACTER JOBZ * .. Local Arrays .. DOUBLE PRECISION D(NMAX), E(NMAX-1), W(NMAX), WORK(LWORK), + Z(LDZ,NMAX) INTEGER ISUPPZ(2*NMAX), IWORK(LIWORK) * .. External Subroutines .. EXTERNAL DSTEGR, X04CAF * .. Executable Statements .. WRITE (NOUT,*) 'F08JLF Example Program Results' WRITE (NOUT,*) * Skip heading in data file READ (NIN,*) READ (NIN,*) N IF (N.LE.NMAX) THEN * * Read the symmetric tridiagonal matrix T from data file, first * the diagonal elements, then the off diagonal elements and then * JOBV ('N' - eigenvalues only, 'V' - vectors as well) * READ (NIN,*) (D(I),I=1,N) READ (NIN,*) (E(I),I=1,N-1) READ (NIN,*) JOBZ * * Calculate all the eigenvalues of T. Set ABSTOL to zero so that * the default value is used. * ABSTOL = 0.0D0 CALL DSTEGR(JOBZ,RANGE,N,D,E,VL,VU,IL,IU,ABSTOL,M,W,Z,LDZ, + ISUPPZ,WORK,LWORK,IWORK,LIWORK,INFO) * IF (INFO.EQ.0) THEN * * Print eigenvalues and eigenvectors * WRITE (NOUT,*) 'Eigenvalues' WRITE (NOUT,99999) (W(I),I=1,M) * WRITE (NOUT,*) IFAIL = 0 CALL X04CAF('General',' ',N,M,Z,LDZ,'Eigenvectors',IFAIL) * ELSE WRITE (NOUT,99998) + 'Failure to compute an eigenvalue, INFO = ', INFO END IF ELSE WRITE (NOUT,*) 'NMAX too small' END IF STOP * 99999 FORMAT ((3X,8F8.4)) 99998 FORMAT (1X,A,I10) END