Program c06safe
! C06SAF Example Program Text
! Mark 28.7 Release. NAG Copyright 2022.
! .. Use Statements ..
Use nag_library, Only: c06saf, nag_wp
! .. Implicit None Statement ..
Implicit None
! .. Parameters ..
Integer, Parameter :: nin = 5, nout = 6
! .. Local Scalars ..
Real (Kind=nag_wp) :: tol
Integer :: d, ifail, ii, k, m, n, p1, p2
! .. Local Arrays ..
Real (Kind=nag_wp), Allocatable :: hin(:), q(:), srcs(:,:), term(:), &
trgs(:,:), v(:)
! .. Executable Statements ..
Write (nout,*) 'C06SAF Example Program Results'
! Skip heading in data file
Read (nin,*)
Read (nin,*) d, n, m
Allocate (q(n))
Allocate (hin(n))
Allocate (srcs(d,n))
Allocate (trgs(d,m))
Allocate (v(m))
Allocate (term(m))
Read (nin,*) p1, p2, k
Read (nin,*) tol
Read (nin,*) q(1:n)
Read (nin,*) hin(1:n)
Read (nin,*) srcs(1:d,1:n)
Read (nin,*) trgs(1:d,1:m)
! ifail: behaviour on error exit
! =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft
ifail = 0
Call c06saf(d,srcs,n,trgs,m,q,p1,p2,k,hin,n,tol,v,term,ifail)
Write (nout,*)
Write (nout,*) ' y FGT(y) term'
Write (nout,*)
Write (nout,99999)(trgs(1:d,ii),v(ii),term(ii),ii=1,m)
99999 Format (2(1X,F4.1),3X,F8.3,4X,F8.6)
End Program c06safe