dsdot Function

public pure function dsdot(n, sx, incx, sy, incy)

NAME

dsdot(3f) - [BLAS:DOUBLE_BLAS_LEVEL1]

SYNOPSIS

 double precision function dsdot(n,sx,incx,sy,incy)

   .. Scalar Arguments ..
   integer,intent(in) :: incx,incy,n
   ..
   .. Array Arguments ..
   real,intent(in) :: sx(*),sy(*)
   ..

DEFINITION

Compute the inner product of two vectors with extended precision accumulation and result.

Returns D.P. dot product accumulated in D.P., for S.P. SX and SY DSDOT = sum for I = 0 to N-1 of SX(LX+IINCX) * SY(LY+IINCY), where LX = 1 if INCX .GE. 0, else LX = 1+(1-N)*INCX, and LY is defined in a similar way using INCY.

OPTIONS

N number of elements in input vector(s) SX array, dimension(N) single precision vector with N elements INCX storage spacing between elements of SX SY array, dimension(N) single precision vector with N elements INCY storage spacing between elements of SY

RETURN

DSDOT dot product (zero if N.LE.0)

AUTHORS

  • Univ. of Tennessee
  • Univ. of California Berkeley
  • Univ. of Colorado Denver
  • NAG Ltd.

date:December 2016

FURTHER DETAILS

 Lawson, C. L., (JPL), Hanson, R. J., (SNLA),
 Kincaid, D. R., (U. of Texas), Krogh, F. T., (JPL)

REFERENCES

C. L. Lawson, R. J. Hanson, D. R. Kincaid and F. T. Krogh, Basic linear algebra subprograms for Fortran usage, Algorithm No. 539, Transactions on Mathematical Software 5, 3 (September 1979), pp. 308-323.

REVISION HISTORY

  1979-10-01  DATE WRITTEN
  1989-08-31  Modified array declarations. (WRB)
  1989-08-31  REVISION DATE from Version 3.2
  1989-12-14  Prologue converted to Version 4.0 format. (BAB)
  1992-03-10  Corrected definition of LX in DESCRIPTION. (WRB)
  1992-05-01  Reformatted the REFERENCES section. (WRB)
  1907-01-18  Reformat to LAPACK style (JL)

SEE ALSO

Online html documentation available at
http://www.netlib.org/lapack/explore-html/

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: n
real, intent(in) :: sx(*)
integer, intent(in) :: incx
real, intent(in) :: sy(*)
integer, intent(in) :: incy

Return Value doubleprecision


Contents

Source Code


Variables

Type Visibility Attributes Name Initial
integer, public :: i
integer, public :: kx
integer, public :: ky
integer, public :: ns

Source Code

pure double precision function dsdot(n,sx,incx,sy,incy)
implicit none
!
!  -- Reference BLAS level1 routine (version 3.7.0) --
!  -- Reference BLAS is a software package provided by Univ. of Tennessee,    --
!  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
!     December 2016
!
!     .. Scalar Arguments ..
      integer,intent(in) :: incx,incy,n
!     ..
!     .. Array Arguments ..
      real,intent(in) :: sx(*),sy(*)
!     ..
!
!  Authors:
!  ========
!  Lawson, C. L., (JPL), Hanson, R. J., (SNLA),
!  Kincaid, D. R., (U. of Texas), Krogh, F. T., (JPL)

!  =====================================================================
!
!     .. Local Scalars ..
      integer i,kx,ky,ns
!     ..
!     .. Intrinsic Functions ..
      intrinsic dble
!     ..
      dsdot = 0.0d0
      if (n.le.0) return
      if (incx.eq.incy .and. incx.gt.0) then
!
!     Code for equal, positive, non-unit increments.
!
         ns = n*incx
         do i = 1,ns,incx
            dsdot = dsdot + dble(sx(i))*dble(sy(i))
         enddo
      else
!
!     Code for unequal or nonpositive increments.
!
         kx = 1
         ky = 1
         if (incx.lt.0) kx = 1 + (1-n)*incx
         if (incy.lt.0) ky = 1 + (1-n)*incy
         do i = 1,n
            dsdot = dsdot + dble(sx(kx))*dble(sy(ky))
            kx = kx + incx
            ky = ky + incy
         enddo
      endif

end function dsdot