dcopy Subroutine

public subroutine dcopy(n, dx, incx, dy, incy)

copies a vector, x, to a vector, y. 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(inout) :: dy(*)
integer, intent(in) :: incy

Called by

proc~~dcopy~~CalledByGraph proc~dcopy lbfgsb_blas_module::dcopy proc~cauchy lbfgsb_module::cauchy proc~cauchy->proc~dcopy proc~formk lbfgsb_module::formk proc~formk->proc~dcopy proc~lnsrlb lbfgsb_module::lnsrlb proc~lnsrlb->proc~dcopy proc~mainlb lbfgsb_module::mainlb proc~mainlb->proc~dcopy proc~mainlb->proc~cauchy proc~mainlb->proc~formk proc~mainlb->proc~lnsrlb proc~matupd lbfgsb_module::matupd proc~mainlb->proc~matupd proc~subsm lbfgsb_module::subsm proc~mainlb->proc~subsm proc~matupd->proc~dcopy proc~subsm->proc~dcopy proc~setulb lbfgsb_module::setulb proc~setulb->proc~mainlb

Source Code

    subroutine dcopy(n,dx,incx,dy,incy)

      implicit none

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

      integer :: i , ix , iy , m , mp1

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

         ! code for both increments equal to 1

         ! clean-up loop

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

      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
            dy(iy) = dx(ix)
            ix = ix + incx
            iy = iy + incy
         end do

      end if

    end subroutine dcopy