    PROGRAM f03aafe

!      F03AAF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : f03aaf, 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, n
!      .. Local Arrays ..
       REAL (KIND=nag_wp), ALLOCATABLE :: a(:,:), wkspce(:)
!      .. Executable Statements ..
       WRITE (nout,*) 'F03AAF 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 f03aaf(a,lda,n,det,wkspce,ifail)

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

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