PROGRAM f16drfe ! F16DRF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : f16drf ! .. Implicit None Statement .. IMPLICIT NONE ! .. Parameters .. INTEGER, PARAMETER :: nin = 5, nout = 6 ! .. Local Scalars .. INTEGER :: i, incx, j, k, n ! .. Local Arrays .. INTEGER, ALLOCATABLE :: x(:) ! .. Intrinsic Functions .. INTRINSIC abs ! .. Executable Statements .. WRITE (nout,*) 'F16DRF Example Program Results' ! Skip heading in data file READ (nin,*) READ (nin,*) n, incx ALLOCATE (x(1+(n-1)*abs(incx))) READ (nin,*) (x(j),j=1,1+(n-1)*abs(incx),incx) ! Find K = ARGMIN(ABS(X)) and I = MIN(ABS(X)). CALL f16drf(n,x,incx,k,i) WRITE (nout,*) WRITE (nout,99999) k WRITE (nout,99998) i 99999 FORMAT (1X,'Index of absolutely smallest component of X is',I3) 99998 FORMAT (1X,'Absolutely smallest value is',I12) END PROGRAM f16drfe