    PROGRAM nag_mat_norm_ex06

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

      ! .. Use Statements ..
      USE nag_examples_io, ONLY : nag_std_in, nag_std_out
      USE nag_mat_norm, ONLY : nag_sym_mat_norm, nag_tri_mat_norm
      ! .. Implicit None Statement ..
      IMPLICIT NONE
      ! .. Intrinsic Functions ..
      INTRINSIC KIND
      ! .. Parameters ..
      INTEGER, PARAMETER :: wp = KIND(1.0D0)
      ! .. Local Scalars ..
      INTEGER :: i, j, n
      CHARACTER (1) :: uplo
      ! .. Local Arrays ..
      REAL (wp), ALLOCATABLE :: a(:)
      ! .. Executable Statements ..
      WRITE (nag_std_out,*) 'Example Program Results for nag_mat_norm_ex06'

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

      ALLOCATE (a((n*(n+1))/2))    ! Allocate storage

      SELECT CASE (uplo)
      CASE ('U','u')
        DO i = 1, n
          READ (nag_std_in,*) (a(i+j*(j-1)/2),j=i,n)
        END DO
      CASE ('L','l')
        DO i = 1, n
          READ (nag_std_in,*) (a(i+(2*n-j)*(j-1)/2),j=1,i)
        END DO
      END SELECT

      WRITE (nag_std_out,*)
      WRITE (nag_std_out,*) 'Norms of the symmetric matrix'
      WRITE (nag_std_out,'(1X,a22,2x,f7.3)') 'One-norm of (a) =', &
       nag_sym_mat_norm(uplo,a)
      WRITE (nag_std_out,'(1X,a22,2x,f7.3)') 'Infinity Norm of (a) =', &
       nag_sym_mat_norm(uplo,a,norm='i')
      WRITE (nag_std_out,'(1X,a22,2x,f7.3)') 'Frobenus Norm of (a) =', &
       nag_sym_mat_norm(uplo,a,norm='f')
      WRITE (nag_std_out,'(1X,a22,2x,f7.3)') 'Max(ABS(a(i,j))) =', &
       nag_sym_mat_norm(uplo,a,norm='m')

      WRITE (nag_std_out,*)
      WRITE (nag_std_out,*) 'Norms of the triangular matrix'
      WRITE (nag_std_out,'(1X,a22,2x,f7.3)') 'One-norm of (a) =', &
       nag_tri_mat_norm(uplo,a)
      WRITE (nag_std_out,'(1X,a22,2x,f7.3)') 'Infinity Norm of (a) =', &
       nag_tri_mat_norm(uplo,a,norm='i')
      WRITE (nag_std_out,'(1X,a22,2x,f7.3)') 'Frobenus Norm of (a) =', &
       nag_tri_mat_norm(uplo,a,norm='f')
      WRITE (nag_std_out,'(1X,a22,2x,f7.3)') 'Max(ABS(a(i,j))) =', &
       nag_tri_mat_norm(uplo,a,norm='m')

      DEALLOCATE (a)               ! Deallocate storage

    END PROGRAM nag_mat_norm_ex06
