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

NAG FL Interface Introduction
Example description
    Program f04mffe

!     F04MFF Example Program Text

!     Mark 30.3 Release. nAG Copyright 2024.

!     .. Use Statements ..
      Use nag_library, Only: f04mff, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: p
      Integer                          :: ifail, k, n
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: b(:), t(:), work(:), x(:)
!     .. Executable Statements ..
      Write (nout,*) 'F04MFF Example Program Results'
      Write (nout,*)
!     Skip heading in data file
      Read (nin,*)
      Read (nin,*) n
      Allocate (b(n),t(0:n-1),work(2*n-1),x(n))
      Read (nin,*) t(0:n-1)
      Read (nin,*) b(1:n)
      Do k = 1, n
!       ifail: behaviour on error exit
!              =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft
        ifail = 0
        Call f04mff(k,t,b,x,p,work,ifail)

        Write (nout,*)
        Write (nout,99999) 'Solution for system of order', k
        Write (nout,99998) x(1:k)
        If (k>1) Then
          Write (nout,*) 'Reflection coefficient'
          Write (nout,99998) p
        End If
      End Do

99999 Format (1X,A,I5)
99998 Format (1X,5F9.4)
    End Program f04mffe