Program g01apfe ! G01APF Example Program Text ! Mark 24 Release. NAG Copyright 2012. ! .. Use Statements .. Use nag_library, Only: g01apf, nag_wp ! .. Implicit None Statement .. Implicit None ! .. Parameters .. Integer, Parameter :: nin = 5, nout = 6 ! .. Local Scalars .. Real (Kind=nag_wp) :: eps Integer :: i, ifail, ind, licomm, lrcomm, & ltcomm, n, nb, np, nq Logical :: repeat ! .. Local Arrays .. Real (Kind=nag_wp), Allocatable :: q(:), qv(:), rcomm(:), rv(:), & trcomm(:) Integer, Allocatable :: icomm(:), ticomm(:) ! .. Executable Statements .. Write (nout,*) 'G01APF Example Program Results' Write (nout,*) ! Skip heading in data file Read (nin,*) ! Read in approximation factor Read (nin,*) eps ! Read in number of elements in the output vector qv Read (nin,*) nq Allocate (qv(nq),q(nq)) ! Read in vector q Read (nin,*) q(1:nq) lrcomm = 100 licomm = 400 nb = 20 Allocate (rcomm(lrcomm),icomm(licomm),rv(nb)) ind = 0 repeat = .True. n = 0 m_lp: Do While (repeat) If (ind==0 .Or. ind==1) Then d_lp: Do i = 1, nb Read (nin,*,Iostat=ifail) rv(i) If (ifail/=0) Then Exit d_lp End If End Do d_lp If (i==1) Then Exit m_lp Else If (i-1