    PROGRAM x03aafe

!      X03AAF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : nag_wp, x03aaf
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: n = 3, nin = 5, nout = 6
!      .. Local Scalars ..
       REAL (KIND=nag_wp)              :: c1, c2, d1, d2
       INTEGER                         :: i, ifail, isizea, isizeb, istepa,    &
                                          istepb, j
       LOGICAL                         :: sw
!      .. Local Arrays ..
       REAL (KIND=nag_wp)              :: a(n,n), b(n)
!      .. Executable Statements ..
       WRITE (nout,*) 'X03AAF Example Program Results'

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

       READ (nin,*) ((a(i,j),j=1,n),i=1,n), (b(i),i=1,n)
       c1 = 1.0E0_nag_wp
       c2 = 0.0E0_nag_wp
       isizea = n
       isizeb = n
       istepa = 1
       istepb = 1
       sw = .TRUE.

       ifail = 0
       CALL x03aaf(a(1,2),isizea,b,isizeb,n,istepa,istepb,c1,c2,d1,d2,sw, &
          ifail)

       WRITE (nout,*)
       WRITE (nout,99999) 'D1 = ', d1, ' D2 = ', d2

99999  FORMAT (1X,A,F4.1,A,F4.1)
    END PROGRAM x03aafe
