Program x04cdfe

!     X04CDF Example Program Text

!     Mark 25 Release. NAG Copyright 2014.

!     .. Use Statements ..
      Use nag_library, Only: nag_wp, x04cdf
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nmax = 5, nout = 6
      Integer, Parameter               :: la = (nmax*(nmax+1))/2
      Character (7), Parameter         :: clabs(nmax) = (/                     &
                                          'Un     ','Deux   ',                 &
                                          'Trois  ','Quatre ','Cinq   ' /)
      Character (7), Parameter         :: rlabs(nmax) = (/                     &
                                          'Uno    ','Due    ',                 &
                                          'Tre    ','Quattro','Cinque ' /)
!     .. Local Scalars ..
      Integer                          :: i, ifail, indent, ncols
!     .. Local Arrays ..
      Real (Kind=nag_wp)               :: a(la)
!     .. Intrinsic Procedures ..
      Intrinsic                        :: real
!     .. Executable Statements ..
      Write (nout,*) 'X04CDF Example Program Results'

      Write (nout,*)
      Flush (nout)

!     Generate an array of data

      Do i = 1, la
        a(i) = real(i,kind=nag_wp)
      End Do

      ncols = 80
      indent = 0

!     Print order (namx-1) lower triangular matrix with default format and
!     integer row and column labels

      ifail = 0
      Call x04cdf('Lower','Non-unit',nmax-1,a,' ','Example 1:','Integer', &
        rlabs,'Integer',clabs,ncols,indent,ifail)

      Write (nout,*)
      Flush (nout)

!     Print order nmax upper triangular matrix with user-supplied format
!     and row and column labels

      ifail = 0
      Call x04cdf('Upper','Unit',nmax,a,'F8.2','Example 2:','Character',rlabs, &
        'Character',clabs,ncols,indent,ifail)

      Write (nout,*)
      Flush (nout)

!     Print order nmax upper triangular matrix in MATLAB format
!     Row and column labelling is ignored

      ifail = 0
      Call x04cdf('Upper','Non-unit',nmax,a,'MATLABF8.2','A',' ',rlabs,' ', &
        clabs,ncols,indent,ifail)

    End Program x04cdfe