PROGRAM g01apfe ! G01APF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. 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