DotProduct.F
c**********************************************************************
#include "author.inc"
c* $Id: DotProduct.F,v 1.6 1995/07/30 17:49:25 turner Exp $
c*
c* Computes the dot product of two vectors.
c*
c* WARNING: Note that JT_DotProduct *must* be declared real in
c* routines that use it.
c*
c* <PARAMETER LIST>
c*
c* Input:
c* n - number of elements
c* x,y - vectors to be dotted
c*
c* Output:
c* JT_DotProduct - dot product
c* status - return status
c*
#include "copyright.inc"
c**********************************************************************
real function JT_DotProduct(n, x, y, status)
implicit none
c
c ... Input:
integer n
real x(n), y(n)
c
c ... Output:
integer status
c
c ... Local:
#ifdef use_blas
real SDOT
#else
integer i
real zero
parameter (zero=0.0d0)
#endif
c
#ifdef use_blas
JT_DotProduct = SDOT(n, x, 1, y, 1)
#else
JT_DotProduct = zero
do i=1,n
JT_DotProduct = JT_DotProduct + x(i)*y(i)
enddo
#endif
c
status = 0
return
end