Program f16dlfe
! F16DLF Example Program Text
! Mark 30.0 Release. NAG Copyright 2024.
! .. Use Statements ..
Use nag_library, Only: f16dlf
! .. Implicit None Statement ..
Implicit None
! .. Parameters ..
Integer, Parameter :: nin = 5, nout = 6
! .. Local Scalars ..
Integer :: i, incx, ix, n, sumval
! .. Local Arrays ..
Integer, Allocatable :: x(:)
! .. Intrinsic Procedures ..
Intrinsic :: abs
! .. Executable Statements ..
Write (nout,*) 'F16DLF Example Program Results'
! Skip heading in data file
Read (nin,*)
Read (nin,*) n, incx
Allocate (x(1+(n-1)*abs(incx)))
! Read the vector x and store forwards or backwards
! as determined by incx.
If (incx>0) Then
ix = 1
Else
ix = 1 - (n-1)*incx
End If
Do i = 1, n
Read (nin,*) x(ix)
ix = ix + incx
End Do
! Sum the elements of x
sumval = f16dlf(n,x,incx)
Write (nout,*)
Write (nout,99999) sumval
99999 Format (1X,'Sum of elements of x is',I5)
End Program f16dlfe