    Program f16ecfe

!     F16ECF Example Program Text

!     Mark 24 Release. NAG Copyright 2012.

!     .. Use Statements ..
      Use nag_library, Only: blas_daxpby, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: alpha, beta
      Integer                          :: incx, incy, n, nx, ny
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: x(:), y(:)
!     .. Intrinsic Procedures ..
      Intrinsic                        :: abs
!     .. Executable Statements ..
      Write (nout,*) 'F16ECF Example Program Results'

!     Skip heading in data file
      Read (nin,*)

      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, beta
      Read (nin,*) x(1:nx:abs(incx))
      Read (nin,*) y(1:ny:abs(incy))

!     Compute Y = ALPHA*X + BETA*Y

      Call blas_daxpby(n,alpha,x,incx,beta,y,incy)

      Write (nout,*)
      Write (nout,99999)
      Write (nout,99998) y(1:ny:abs(incy))

99999 Format (1X,'Result of scaled vector addition is')
99998 Format (1X,'Y =',5F9.4)
    End Program f16ecfe
