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

NAG FL Interface Introduction
Example description
    Program g10cafe

!     G10CAF Example Program Text

!     Mark 29.0 Release. NAG Copyright 2023.

!     .. Use Statements ..
      Use nag_library, Only: g10caf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Integer                          :: i, ifail, itype, n
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: rough0(:), rough1(:), smooth0(:),    &
                                          smooth1(:), y(:)
!     .. Executable Statements ..
      Write (nout,*) ' G10CAF Example Program Results'
      Write (nout,*)

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

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

      Allocate (y(n),rough0(n),smooth0(n),rough1(n),smooth1(n))

!     Read in data
      Read (nin,*) y(1:n)

!     Smooth sequence using 3RSSH,twice
      itype = 1
      ifail = 0
      Call g10caf(itype,n,y,smooth1,rough1,ifail)

!     Smooth sequence using 4253H,twice
      itype = 0
      ifail = 0
      Call g10caf(itype,n,y,smooth0,rough0,ifail)

!     Display results
      Write (nout,*)                                                           &
        '                      Using 3RSSH,twice         Using 4253H,twice'
      Write (nout,*)                                                           &
        ' Index     Data      Smooth        Rough       Smooth       Rough'
      Write (nout,99999)(i,y(i),smooth1(i),rough1(i),smooth0(i),rough0(i),i=1, &
        n)

99999 Format (1X,I4,F11.1,2F13.4,2F13.1)
    End Program g10cafe