    PROGRAM nag_nsym_eig_ex02

      ! 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_schur_fac
      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 ..
      REAL (wp), ALLOCATABLE :: a(:,:), z(:,:)
      COMPLEX (wp), ALLOCATABLE :: lambda(:)
      ! .. Executable Statements ..
      WRITE (nag_std_out,*) 'Example Program Results for nag_nsym_eig_ex02'

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

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

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

      ! Compute the Schur factorization

      CALL nag_schur_fac(a,lambda=lambda,z=z)

      WRITE (nag_std_out,*)
      WRITE (nag_std_out,*) 'Eigenvalues'
      WRITE (nag_std_out,'(1X,"(",F8.4,",",F8.4,")")') lambda
      WRITE (nag_std_out,*)

      CALL nag_write_gen_mat(a,int_col_labels=.TRUE.,title='Schur matrix')

      WRITE (nag_std_out,*)

      CALL nag_write_gen_mat(z,int_col_labels=.TRUE., &
       title='Matrix of Schur vectors (one vector per column)')

      DEALLOCATE (a,lambda,z)      ! Deallocate storage

    END PROGRAM nag_nsym_eig_ex02
