    PROGRAM x04defe

!      X04DEF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : nag_wp, x04def
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: nmax = 5, 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 Functions ..
       INTRINSIC                          cmplx, real
!      .. Executable Statements ..
       WRITE (nout,*) 'X04DEF 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 band matrix with 1 sub-diagonal and 1 super-diagonal

       ifail = 0
       CALL x04def(nmax,nmax,1,1,a,lda,'Band Matrix:',ifail)

    END PROGRAM x04defe
