    PROGRAM f03adfe

!      F03ADF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : f03adf, nag_wp
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: nin = 5, nout = 6
!      .. Local Scalars ..
       REAL (KIND=nag_wp)              :: deti, detr
       INTEGER                         :: i, ifail, lda, n
!      .. Local Arrays ..
       COMPLEX (KIND=nag_wp), ALLOCATABLE :: a(:,:)
       REAL (KIND=nag_wp), ALLOCATABLE :: wkspce(:)
!      .. Executable Statements ..
       WRITE (nout,*) 'F03ADF Example Program Results'

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

       READ (nin,*) n
       lda = n
       ALLOCATE (a(lda,n),wkspce(n))

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

       ifail = 0
       CALL f03adf(a,lda,n,detr,deti,wkspce,ifail)

       WRITE (nout,*)
       WRITE (nout,99999) detr, deti

99999  FORMAT (1X,'Value of determinant = (',F9.4,',',F9.4,')')
    END PROGRAM f03adfe
