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

NAG FL Interface Introduction
Example description
    Program g13ahfe

!     G13AHF Example Program Text

!     Mark 30.0 Release. NAG Copyright 2024.

!     .. Use Statements ..
      Use nag_library, Only: g13ahf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: c, rms
      Integer                          :: ifail, nfv, npar, nst, nwa
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: fsd(:), fva(:), par(:), st(:), wa(:)
      Integer                          :: mr(7)
!     .. Intrinsic Procedures ..
      Intrinsic                        :: max
!     .. Executable Statements ..
      Write (nout,*) 'G13AHF Example Program Results'
      Write (nout,*)

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

!     Read in problem size etc
      Read (nin,*) nfv, c

!     Read in the orders
      Read (nin,*) mr(1:7)

!     Calculate NPAR and various array lengths
      npar = mr(1) + mr(3) + mr(4) + mr(6)
      nst = mr(4)*mr(7) + mr(5)*mr(7) + mr(2) + mr(3) + max(mr(1),mr(6)*mr(7))
      nwa = 4*npar + 3*nst

      Allocate (fsd(nfv),fva(nfv),par(npar),st(nst),wa(nwa))

!     Read in parameter estimates
      Read (nin,*) par(1:npar)

!     Read in state set from G13AEF, G13AFF or G13AGF
      Read (nin,*) st(1:nst)

!     Read in residual variance
      Read (nin,*) rms

!     Produce forecasts
      ifail = 0
      Call g13ahf(st,nst,mr,par,npar,c,rms,nfv,fva,fsd,wa,nwa,ifail)

      Write (nout,99998) 'The required', nfv,                                  &
        ' forecast values are as follows'
      Write (nout,99999) fva(1:nfv)
      Write (nout,*)
      Write (nout,*)                                                           &
        'The standard deviations corresponding to the forecasts are'
      Write (nout,99999) fsd(1:nfv)

99999 Format (1X,8F8.4)
99998 Format (1X,A,I3,A)
    End Program g13ahfe