Program f04fffe
! F04FFF Example Program Text
! Mark 30.1 Release. NAG Copyright 2024.
! .. Use Statements ..
Use nag_library, Only: f04fff, nag_wp
! .. Implicit None Statement ..
Implicit None
! .. Parameters ..
Integer, Parameter :: nin = 5, nout = 6
! .. Local Scalars ..
Integer :: ifail, n
Logical :: wantp
! .. Local Arrays ..
Real (Kind=nag_wp), Allocatable :: b(:), p(:), t(:), work(:), x(:)
! .. Executable Statements ..
Write (nout,*) 'F04FFF Example Program Results'
! Skip heading in data file
Read (nin,*)
Read (nin,*) n
Write (nout,*)
Allocate (b(n),p(n-1),t(0:n-1),work(2*(n-1)),x(n))
Read (nin,*) t(0:n-1)
Read (nin,*) b(1:n)
wantp = .True.
! ifail: behaviour on error exit
! =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft
ifail = 1
Call f04fff(n,t,b,x,wantp,p,work,ifail)
If (ifail==0) Then
Write (nout,*)
Write (nout,*) 'Solution vector'
Write (nout,99998) x(1:n)
If (wantp) Then
Write (nout,*)
Write (nout,*) 'Reflection coefficients'
Write (nout,99998) p(1:n-1)
End If
Else If (ifail>0) Then
Write (nout,*)
Write (nout,99999) 'Solution for system of order', ifail - 1
Write (nout,99998) x(1:ifail-1)
If (wantp) Then
Write (nout,*)
Write (nout,*) 'Reflection coefficients'
Write (nout,99998) p(1:ifail-1)
End If
Else
Write (nout,99997) ifail
End If
99999 Format (1X,A,I5)
99998 Format (1X,5F9.4)
99997 Format (1X,' ** F04FFF returned with IFAIL = ',I5)
End Program f04fffe