ddot Function

public function ddot(n, dx, incx, dy, incy)

forms the dot product of two vectors. uses unrolled loops for increments equal to one.

Author

jack dongarra, linpack, 3/11/78.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: n
real(kind=wp), intent(in) :: dx(*)
integer, intent(in) :: incx
real(kind=wp), intent(in) :: dy(*)
integer, intent(in) :: incy

Return Value real(kind=wp)


Called by

proc~~ddot~~CalledByGraph proc~ddot lbfgsb_blas_module::ddot proc~cauchy lbfgsb_module::cauchy proc~cauchy->proc~ddot proc~bmv lbfgsb_module::bmv proc~cauchy->proc~bmv proc~dpofa lbfgsb_linpack_module::dpofa proc~dpofa->proc~ddot proc~dtrsl lbfgsb_linpack_module::dtrsl proc~dtrsl->proc~ddot proc~formk lbfgsb_module::formk proc~formk->proc~ddot proc~formk->proc~dpofa proc~formk->proc~dtrsl proc~lnsrlb lbfgsb_module::lnsrlb proc~lnsrlb->proc~ddot proc~mainlb lbfgsb_module::mainlb proc~mainlb->proc~ddot proc~mainlb->proc~cauchy proc~mainlb->proc~formk proc~mainlb->proc~lnsrlb proc~matupd lbfgsb_module::matupd proc~mainlb->proc~matupd proc~formt lbfgsb_module::formt proc~mainlb->proc~formt proc~subsm lbfgsb_module::subsm proc~mainlb->proc~subsm proc~cmprlb lbfgsb_module::cmprlb proc~mainlb->proc~cmprlb proc~matupd->proc~ddot proc~bmv->proc~dtrsl proc~formt->proc~dpofa proc~setulb lbfgsb_module::setulb proc~setulb->proc~mainlb proc~subsm->proc~dtrsl proc~cmprlb->proc~bmv

Source Code

      real(wp) function ddot(n,dx,incx,dy,incy)

      implicit none

      integer,intent(in) :: n
      real(wp),intent(in) :: dx(*)
      integer,intent(in) :: incx
      real(wp),intent(in) :: dy(*)
      integer,intent(in) :: incy

      real(wp) :: dtemp
      integer :: i , ix , iy , m , mp1

      ddot = zero
      dtemp = zero
      if ( n<=0 ) return
      if ( incx==1 .and. incy==1 ) then

         ! code for both increments equal to 1

         ! clean-up loop

         m = mod(n,5)
         if ( m/=0 ) then
            do i = 1 , m
               dtemp = dtemp + dx(i)*dy(i)
            end do
            if ( n<5 ) then
               ddot = dtemp
               return
            end if
         end if
         mp1 = m + 1
         do i = mp1 , n , 5
            dtemp = dtemp + dx(i)*dy(i) + dx(i+1)*dy(i+1) + &
                    dx(i+2)*dy(i+2) + dx(i+3)*dy(i+3) + dx(i+4)*dy(i+4)
         end do
         ddot = dtemp

      else

         ! code for unequal increments or equal increments
         ! not equal to 1

         ix = 1
         iy = 1
         if ( incx<0 ) ix = (-n+1)*incx + 1
         if ( incy<0 ) iy = (-n+1)*incy + 1
         do i = 1 , n
            dtemp = dtemp + dx(ix)*dy(iy)
            ix = ix + incx
            iy = iy + incy
         end do
         ddot = dtemp

      end if

      end function ddot