    PROGRAM f03acfe

!      F03ACF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : f03acf, nag_wp
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: nin = 5, nout = 6
!      .. Local Scalars ..
       REAL (KIND=nag_wp)              :: det
       INTEGER                         :: i, ifail, lda, ldrl, m, m1, n
!      .. Local Arrays ..
       REAL (KIND=nag_wp), ALLOCATABLE :: a(:,:), rl(:,:)
!      .. Executable Statements ..
       WRITE (nout,*) 'F03ACF Example Program Results'

!      Skip heading in data file
       READ (nin,*)

       READ (nin,*) n, m
       lda = n
       ldrl = n
       m1 = m + 1
       ALLOCATE (a(lda,m1),rl(ldrl,m1))

       READ (nin,*) (a(i,1:m1),i=1,n)

       ifail = 0
       CALL f03acf(a,lda,n,m,det,rl,ldrl,m1,ifail)

       WRITE (nout,*)
       WRITE (nout,99999) 'Value of determinant = ', det

99999  FORMAT (1X,A,F9.4)
    END PROGRAM f03acfe
