Program f16eafe
! F16EAF Example Program Text
! Mark 25 Release. NAG Copyright 2014.
! .. Use Statements ..
Use nag_library, Only: blas_ddot, nag_wp
! .. Implicit None Statement ..
Implicit None
! .. Parameters ..
Integer, Parameter :: nin = 5, nout = 6
! .. Local Scalars ..
Real (Kind=nag_wp) :: alpha, beta, r
Integer :: conj, i, incx, incy, n, nx, ny
! .. Local Arrays ..
Real (Kind=nag_wp), Allocatable :: x(:), y(:)
! .. Intrinsic Procedures ..
Intrinsic :: abs
! .. Executable Statements ..
Write (nout,*) 'F16EAF Example Program Results'
Write (nout,*)
! Skip heading in data file.
Read (nin,*)
! Accumulate two dot products, set beta=zero initially.
beta = 0.0_nag_wp
Do i = 1, 2
! Read data for dot product.
Read (nin,*) n
Read (nin,*) incx, incy
nx = 1 + (n-1)*abs(incx)
ny = 1 + (n-1)*abs(incy)
Allocate (x(nx),y(ny))
Read (nin,*) alpha
Read (nin,*) x(1:nx)
Read (nin,*) y(1:ny)
! Compute r = beta*r + alpha*(x^T*y).
! The NAG name equivalent of blas_ddot is f16eaf.
Call blas_ddot(conj,n,alpha,x,incx,beta,y,incy,r)
! Reset beta for accumulation and deallocate x, y.
beta = 1.0_nag_wp
Deallocate (x,y)
End Do
Write (nout,99999) r
99999 Format (1X,'Accumulated dot product, r = ',F9.4)
End Program f16eafe