    PROGRAM x04ebfe

!      X04EBF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : x04ebf
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: nmax = 5, nout = 6
       INTEGER, PARAMETER              :: lda = nmax
       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, j, ncols
!      .. Local Arrays ..
       INTEGER                         :: a(lda,nmax)
!      .. Executable Statements ..
       WRITE (nout,*) 'X04EBF Example Program Results'

       WRITE (nout,*)
       FLUSH (nout)

!      Generate an array of data

       DO j = 1, nmax

          DO i = 1, lda
             a(i,j) = 10*i + j
          END DO

       END DO

       ncols = 80
       indent = 0

!      Print 3 by nmax rectangular matrix with default format and integer
!      row and column labels

       ifail = 0
       CALL x04ebf('General',' ',3,nmax,a,lda,' ','Example 1:','Integer', &
          rlabs,'Integer',clabs,ncols,indent,ifail)

       WRITE (nout,*)
       FLUSH (nout)

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

       ifail = 0
       CALL x04ebf('Upper','Non-unit',nmax,nmax,a,lda,'I8','Example 2:', &
          'Character',rlabs,'Character',clabs,ncols,indent,ifail)

       WRITE (nout,*)
       FLUSH (nout)

!      Print 4 by nmax lower triangular matrix in MATLAB format
!      Row and column labelling is ignored

       ifail = 0
       CALL x04ebf('Lower','Non-unit',4,nmax,a,lda,'MATLABI8','A',' ',rlabs, &
          ' ',clabs,ncols,indent,ifail)

    END PROGRAM x04ebfe
