dasum Function

public function dasum(n, dx, incx)

dasum takes the sum of the absolute values.

Arguments

Type IntentOptional Attributes Name
integer(kind=ip) :: n
real(kind=wp) :: dx(*)
integer(kind=ip) :: incx

Return Value real(kind=wp)


Called by

proc~~dasum~~CalledByGraph proc~dasum bspline_blas_module::dasum proc~dlsei bspline_defc_module::dlsei proc~dlsei->proc~dasum proc~dlsi bspline_defc_module::dlsi proc~dlsei->proc~dlsi proc~dlsi->proc~dasum proc~dlpdp bspline_defc_module::dlpdp proc~dlsi->proc~dlpdp proc~dwnlsm bspline_defc_module::dwnlsm proc~dwnlsm->proc~dasum proc~dfcmn bspline_defc_module::dfcmn proc~dfcmn->proc~dlsei proc~dwnnls bspline_defc_module::dwnnls proc~dwnnls->proc~dwnlsm proc~dfc bspline_defc_module::dfc proc~dfc->proc~dfcmn proc~dlpdp->proc~dwnnls

Source Code

   real(wp) function dasum(n,dx,incx)
         !! dasum takes the sum of the absolute values.

         integer(ip) :: incx,n
         real(wp) :: dx(*)

         real(wp) dtemp
         integer(ip) i,m,mp1,nincx

         dasum = 0.0_wp
         dtemp = 0.0_wp
         if (n<=0 .or. incx<=0) return
         if (incx==1) then
            ! code for increment equal to 1
            ! clean-up loop
            m = mod(n,6)
            if (m/=0) then
               do i = 1,m
                  dtemp = dtemp + abs(dx(i))
               end do
               if (n<6) then
                  dasum = dtemp
                  return
               end if
            end if
            mp1 = m + 1
            do i = mp1,n,6
               dtemp = dtemp + abs(dx(i)) + abs(dx(i+1)) + &
                       abs(dx(i+2)) + abs(dx(i+3)) + &
                       abs(dx(i+4)) + abs(dx(i+5))
            end do
         else
            ! code for increment not equal to 1
            nincx = n*incx
            do i = 1,nincx,incx
               dtemp = dtemp + abs(dx(i))
            end do
         end if
         dasum = dtemp

   end function dasum