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

NAG FL Interface Introduction
Example description
    Program g13aufe

!     G13AUF Example Program Text

!     Mark 30.0 Release. NAG Copyright 2024.

!     .. Use Statements ..
      Use nag_library, Only: g13auf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Integer                          :: i, ifail, m, n, ngrps
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: mean(:), y(:), z(:)
!     .. Executable Statements ..
      Write (nout,*) 'G13AUF Example Program Results'
      Write (nout,*)

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

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

      ngrps = n/m

      Allocate (z(n),y(ngrps),mean(ngrps))

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

!     Calculate summary statistics
      ifail = 0
      Call g13auf(n,z,m,ngrps,'RANGE',y,mean,ifail)

!     Display title
      Write (*,*) '     Mean      Range'
      Write (*,*) '   -------------------'
      Do i = 1, ngrps
        Write (nout,99999) mean(i), y(i)
      End Do

99999 Format (2(1X,F10.3))
    End Program g13aufe