    Program f16ghfe

!     F16GHF Example Program Text

!     Mark 24 Release. NAG Copyright 2012.

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

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

      Read (nin,*) n
      Read (nin,*) incx, incy, incw

      nw = 1 + (n-1)*abs(incw)
      nx = 1 + (n-1)*abs(incx)
      ny = 1 + (n-1)*abs(incy)
      Allocate (w(nw),x(nx),y(ny))

      Read (nin,*) alpha, beta
      Read (nin,*) x(1:nx:abs(incx))
      Read (nin,*) y(1:ny:abs(incy))

!     Compute W = alpha*X + beta*Y

      Call blas_zwaxpby(n,alpha,x,incx,beta,y,incy,w,incw)

      Write (nout,*)
      Write (nout,99999)
      Write (nout,99998) w(1:nw:abs(incw))

99999 Format (1X,'Result of scaled vector addition is')
99998 Format (1X,'W = ( ',2('(',F9.4,',',F9.4,'), '),'(',F9.4,',',F9.4,') )')
    End Program f16ghfe
