    PROGRAM nag_nsym_eig_ex04

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

      ! .. Use Statements ..
      USE nag_examples_io, ONLY : nag_std_in, nag_std_out
      USE nag_nsym_eig, ONLY : nag_nsym_eig_all
      USE nag_write_mat, ONLY : nag_write_gen_mat
      ! .. Implicit None Statement ..
      IMPLICIT NONE
      ! .. Intrinsic Functions ..
      INTRINSIC KIND
      ! .. Parameters ..
      INTEGER, PARAMETER :: wp = KIND(1.0D0)
      ! .. Local Scalars ..
      INTEGER :: i, n
      ! .. Local Arrays ..
      COMPLEX (wp), ALLOCATABLE :: a(:,:), lambda(:), vr(:,:)
      ! .. Executable Statements ..
      WRITE (nag_std_out,*) 'Example Program Results for nag_nsym_eig_ex04'

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

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

      READ (nag_std_in,*) (a(i,:),i=1,n)

      ! Compute eigenvalues and eigenvectors

      CALL nag_nsym_eig_all(a,lambda=lambda,vr=vr)

      WRITE (nag_std_out,*)
      WRITE (nag_std_out,*) 'Eigenvalues'
      WRITE (nag_std_out,'(3X,8("(",F7.4,",",F7.4,")":1X))') lambda
      WRITE (nag_std_out,*)

      CALL nag_write_gen_mat(vr,int_col_labels=.TRUE.,format='(F7.4)', &
       title='Matrix of right eigenvectors (one vector per column)')

      DEALLOCATE (a,lambda,vr)     ! Deallocate storage

    END PROGRAM nag_nsym_eig_ex04
