dscal Subroutine

public subroutine dscal(n, da, dx, incx)

DSCAL scales a vector by a constant. uses unrolled loops for increment equal to 1.

Arguments

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

Called by

proc~~dscal~~CalledByGraph proc~dscal bspline_blas_module::dscal proc~defcmn bspline_defc_module::defcmn proc~defcmn->proc~dscal proc~dfcmn bspline_defc_module::dfcmn proc~dfcmn->proc~dscal proc~dlsei bspline_defc_module::dlsei proc~dfcmn->proc~dlsei proc~dlpdp bspline_defc_module::dlpdp proc~dlpdp->proc~dscal proc~dwnnls bspline_defc_module::dwnnls proc~dlpdp->proc~dwnnls proc~dlsei->proc~dscal proc~dlsi bspline_defc_module::dlsi proc~dlsei->proc~dlsi proc~dlsi->proc~dscal proc~dlsi->proc~dlpdp proc~dwnlit bspline_defc_module::dwnlit proc~dwnlit->proc~dscal proc~dwnlsm bspline_defc_module::dwnlsm proc~dwnlsm->proc~dscal proc~dwnlsm->proc~dwnlit proc~defc bspline_defc_module::defc proc~defc->proc~defcmn proc~dfc bspline_defc_module::dfc proc~dfc->proc~dfcmn proc~dwnnls->proc~dwnlsm

Source Code

   subroutine dscal(n, da, dx, incx)
         !! DSCAL scales a vector by a constant.
         !! uses unrolled loops for increment equal to 1.

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

      integer i, m, mp1, nincx

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

   end subroutine dscal