    PROGRAM f16ghfe

!      F16GHF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. 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                         :: i, incw, incx, incy, n
!      .. Local Arrays ..
       COMPLEX (KIND=nag_wp), ALLOCATABLE :: w(:), x(:), y(:)
!      .. Intrinsic Functions ..
       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
       ALLOCATE (w(1+(n-1)*abs(incw)),x(1+(n-1)*abs(incx)),y(1+(n- &
          1)*abs(incy)))

       READ (nin,*) alpha, beta
       READ (nin,*) (x(i),i=1,1+(n-1)*abs(incx),incx)
       READ (nin,*) (y(i),i=1,1+(n-1)*abs(incy),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(i),i=1,1+(n-1)*abs(incw),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
