    PROGRAM nag_sym_eig_ex13

      ! Example Program Text for nag_sym_eig
      ! NAG fl90, Release 4. NAG Copyright 2000.

      ! .. Use Statements ..
      USE nag_examples_io, ONLY : nag_std_in, nag_std_out
      USE nag_write_mat, ONLY : nag_write_gen_mat
      USE nag_sym_eig, ONLY : nag_sym_eig_sel
      ! .. Implicit None Statement ..
      IMPLICIT NONE
      ! .. Intrinsic Functions ..
      INTRINSIC KIND
      ! .. Parameters ..
      INTEGER, PARAMETER :: wp = KIND(1.0D0)
      ! .. Local Scalars ..
      INTEGER :: i, il, iu, n
      CHARACTER (1) :: uplo
      ! .. Local Arrays ..
      REAL (wp), POINTER :: lambda(:)
      COMPLEX (wp), ALLOCATABLE :: a(:,:)
      COMPLEX (wp), POINTER :: z(:,:)
      ! .. Executable Statements ..
      WRITE (nag_std_out,*) 'Example Program Results for nag_sym_eig_ex13'

      READ (nag_std_in,*)          ! Skip heading in data file
      READ (nag_std_in,*) uplo
      READ (nag_std_in,*) n
      READ (nag_std_in,*) il, iu

      ALLOCATE (a(n,n))            ! Allocate storage

      SELECT CASE (uplo)
      CASE ('L','l')
        READ (nag_std_in,*) (a(i,:i),i=1,n)
      CASE ('U','u')
        READ (nag_std_in,*) (a(i,i:),i=1,n)
      END SELECT

      ! Compute the eigenvalues and eigenvectors of A

      CALL nag_sym_eig_sel(uplo,a,lambda,il=il,iu=iu,z=z)

      WRITE (nag_std_out,*)
      WRITE (nag_std_out,*) 'Selected eigenvalues'
      WRITE (nag_std_out,'(12X,5(F6.3:,10X))') lambda
      WRITE (nag_std_out,*)

      CALL nag_write_gen_mat(z,format='(F6.3)',title='Selected eigenvectors')

      DEALLOCATE (a,lambda,z)      ! Deallocate storage

      NULLIFY (lambda,z)

    END PROGRAM nag_sym_eig_ex13
