    Program x04dafe

!     X04DAF Example Program Text

!     Mark 24 Release. NAG Copyright 2012.

!     .. Use Statements ..
      Use nag_library, Only: nag_wp, x04daf
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nmax = 4, nout = 6
      Integer, Parameter               :: lda = nmax
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: aa
      Integer                          :: i, ifail, j
!     .. Local Arrays ..
      Complex (Kind=nag_wp)            :: a(lda,nmax)
!     .. Intrinsic Procedures ..
      Intrinsic                        :: cmplx, real
!     .. Executable Statements ..
      Write (nout,*) 'X04DAF Example Program Results'

      Write (nout,*)
      Flush (nout)

!     Generate an array of data

      Do j = 1, nmax

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

      End Do

!     Print nmax by (nmax-1) rectangular matrix

      ifail = 0
      Call x04daf('General',' ',nmax,nmax-1,a,lda,'Example 1:',ifail)

      Write (nout,*)
      Flush (nout)

!     Print nmax by nmax lower triangular matrix

      ifail = 0
      Call x04daf('Lower','Non-unit',nmax,nmax,a,lda,'Example 2:',ifail)

    End Program x04dafe
