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

NAG FL Interface Introduction
Example description
    Program g13aafe

!     G13AAF Example Program Text

!     Mark 30.3 Release. nAG Copyright 2024.

!     .. Use Statements ..
      Use nag_library, Only: g13aaf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Integer                          :: ifail, nd, nds, ns, nx, nxd
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: x(:), xd(:)
!     .. Executable Statements ..
      Write (nout,*) 'G13AAF Example Program Results'
      Write (nout,*)

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

!     Read in the problem size
      Read (nin,*) nx, nd, nds, ns

      Allocate (x(nx),xd(nx))

!     Read in data
      Read (nin,*) x(1:nx)

!     Perform differencing
      ifail = 0
      Call g13aaf(x,nx,nd,nds,ns,xd,nxd,ifail)

!     Display results
      Write (nout,99999) 'Non-seasonal differencing of order ', nd,            &
        ' and seasonal differencing'
      Write (nout,99999) 'of order ', nds, ' with seasonality ', ns,           &
        ' are applied'
      Write (nout,*)
      Write (nout,99998) 'The output array holds ', nx,                        &
        ' values, of which the first ', nxd, ' are differenced values'
      Write (nout,*)
      Write (nout,99997) xd(1:nx)

99999 Format (1X,A,I1,A,I1,A)
99998 Format (1X,A,I2,A,I2,A)
99997 Format (1X,5F9.1)
    End Program g13aafe