NAG Library Manual, Mark 30.1
Interfaces:  FL   CL   CPP   AD 

NAG FL Interface Introduction
Example description
    Program g02fcfe

!     G02FCF Example Program Text

!     Mark 30.1 Release. NAG Copyright 2024.

!     .. Use Statements ..
      Use nag_library, Only: g02fcf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: d, pdl, pdu
      Integer                          :: i, ifail, ip, n
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: res(:), work(:)
!     .. Executable Statements ..
      Write (nout,*) 'G02FCF Example Program Results'
      Write (nout,*)

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

!     Read in the problem size
      Read (nin,*) n, ip

      Allocate (res(n),work(n))

!     Read in the data
      Read (nin,*)(res(i),i=1,n)

!     Calculate the statistic
      ifail = 0
      Call g02fcf(n,ip,res,d,pdl,pdu,work,ifail)

!     Display the results
      Write (nout,99999) ' Durbin-Watson statistic ', d
      Write (nout,*)
      Write (nout,99998) ' Lower and upper bound ', pdl, pdu

99999 Format (1X,A,F10.4)
99998 Format (1X,A,2F10.4)
    End Program g02fcfe