    PROGRAM f08jffe

!      F08JFF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : dsterf, nag_wp
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: nin = 5, nout = 6
!      .. Local Scalars ..
       INTEGER                         :: info, n
!      .. Local Arrays ..
       REAL (KIND=nag_wp), ALLOCATABLE :: d(:), e(:)
!      .. Executable Statements ..
       WRITE (nout,*) 'F08JFF Example Program Results'
!      Skip heading in data file
       READ (nin,*)
       READ (nin,*) n

       ALLOCATE (d(n),e(n-1))

!      Read T from data file

       READ (nin,*) d(1:n)
       READ (nin,*) e(1:n-1)

!      Calculate the eigenvalues of T
!      The NAG name equivalent of dsterf is f08jff
       CALL dsterf(n,d,e,info)

       WRITE (nout,*)
       IF (info>0) THEN
          WRITE (nout,*) 'Failure to converge.'
       ELSE
          WRITE (nout,*) 'Eigenvalues'
          WRITE (nout,99999) d(1:n)
       END IF

99999  FORMAT (3X,(9F8.4))
    END PROGRAM f08jffe
