Example description
    Program x04ddfe

!     X04DDF Example Program Text

!     Mark 26.2 Release. NAG Copyright 2017.

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

      Write (nout,*)
      Flush (nout)

!     Generate a full-format symmetric array of data

      lda = n
      Allocate (a(lda,n))

      Do j = 1, n

        Do i = 1, j
          aa = real(10*i+j,kind=nag_wp)
          a(i,j) = cmplx(aa,-aa,kind=nag_wp)
          a(j,i) = a(i,j)
        End Do

      End Do

      ncols = 80
      indent = 0

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

!     Convert a to packed storage.

      Allocate (ap(n*(n+1)/2))

!     The lower triangle.

      uplo = 'L'

!     The NAG name equivalent of ztrttp is f01vbf
      Call ztrttp(uplo,n,a,lda,ap,info)

      If (info/=0) Then
        Write (nout,99999) 'Failure in ZTRTTP. INFO =', info
        Go To 100
      End If

      form = ' '

      ifail = 0
      Call x04ddf('Lower','Non-unit',n,ap,'Bracketed',form,'Example 1:',       &
        'Integer',rlabs,'Integer',clabs,ncols,indent,ifail)

      Write (nout,*)
      Flush (nout)

!     Print order n upper triangular matrix with user-supplied format
!     and row and column labels, using the supplied format directly

!     Convert the upper triangle of a to packed storage.

      uplo = 'U'

!     The NAG name equivalent of ztrttp is f01vbf
      Call ztrttp(uplo,n,a,lda,ap,info)

      If (info/=0) Then
        Write (nout,99999) 'Failure in ZTRTTP. INFO =', info
        Go To 100
      End If

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

      ifail = 0
      Call x04ddf('Upper','Unit',n,ap,'Direct',form,'Example 2:','Character',  &
        rlabs,'Character',clabs,ncols,indent,ifail)

      Write (nout,*)
      Flush (nout)

!     Print order n upper triangular matrix in MATLAB format
!     Row and column labelling and USEFRM are ignored

      form = 'MATLABF8.2'

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

100   Continue

99999 Format (1X,A,I4)
    End Program x04ddfe