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

NAG FL Interface Introduction
Example description
    Program c09bafe

!     C09BAF Example Program Text

!     Mark 30.0 Release. NAG Copyright 2024.

!     .. Use Statements ..
      Use nag_library, Only: c09baf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Integer                          :: ifail, j, n, nscal, wparam
      Character (10)                   :: wavnam
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: c(:,:), x(:)
      Integer, Allocatable             :: scales(:)
!     .. Intrinsic Procedures ..
      Intrinsic                        :: trim
!     .. Executable Statements ..
      Write (nout,*) 'C09BAF Example Program Results'
      Write (nout,*)
!     Skip heading in data file
      Read (nin,*)
!     Read problem parameters
      Read (nin,*) n, nscal
      Allocate (c(nscal,n),scales(nscal),x(n))
      Read (nin,*) wavnam, wparam
      Write (nout,99999) trim(wavnam), wparam, n, nscal

!     Read data array and write it out

      Read (nin,*) scales(1:nscal)
      Read (nin,*) x(1:n)

      Write (nout,99998) scales(1:nscal)
      Write (nout,99997) x(1:n)

!     ifail: behaviour on error exit
!             =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft
      ifail = 0
      Call c09baf(wavnam,wparam,n,x,nscal,scales,c,ifail)

      Write (nout,99996) nscal
      Write (nout,99995) scales(1:nscal)
      Do j = 1, n
        Write (nout,99994) c(1:nscal,j)
      End Do

99999 Format (2X,'Parameters read from file ::',/,4X,'Wavelet : ',A,           &
        ',  wparam : ',I6,/,10X,'n : ',I6,',   nscal : ',I6)
99998 Format (/,2X,'Input Data ::',/,4X,' Scales :',5(I8,1X),:)
99997 Format (5X,'     x :',5(F8.3,1X),(/,13X,5(F8.3,1X)),:)
99996 Format (/,2X,'Number of Scales :      ',I10)
99995 Format (2X,'Wavelet coefficients C ::',/,4X,'Scale :',I7,3I13)
99994 Format (10X,4(1P,E11.4,2X),:)
    End Program c09bafe