    Program x04ddfe

!     X04DDF Example Program Text

!     Mark 24 Release. NAG Copyright 2012.

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

      Write (nout,*)
      Flush (nout)

!     Generate an array of data

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

      ncols = 80
      indent = 0

!     Print order nmax lower triangular matrix with default format and
!     integer row and column labels, and bracketed complex elements

      form = ' '

      ifail = 0
      Call x04ddf('Lower','Non-unit',nmax,a,'Bracketed',form,'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, using the supplied format directly

      form = 'SS,F7.1,SP,F6.1,''i'''

      ifail = 0
      Call x04ddf('Upper','Unit',nmax,a,'Direct',form,'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 and USEFRM are ignored

      form = 'MATLABF8.2'

      ifail = 0
      Call x04ddf('Upper','Non-unit',nmax,a,' ',form,'A',' ',rlabs,' ',clabs, &
        ncols,indent,ifail)

    End Program x04ddfe
