    Program x04cafe

!     X04CAF Example Program Text

!     Mark 24 Release. NAG Copyright 2012.

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

      Write (nout,*)
      Flush (nout)

!     Generate an array of data

      Do j = 1, nmax

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

      End Do

!     Print 3 by nmax rectangular matrix

      ifail = 0
      Call x04caf('General',' ',3,nmax,a,lda,'Example 1:',ifail)

      Write (nout,*)
      Flush (nout)

!     Print nmax by nmax lower triangular matrix

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

    End Program x04cafe
