stdlib_zcopy Subroutine

public pure subroutine stdlib_zcopy(n, zx, incx, zy, incy)

ZCOPY copies a vector, x, to a vector, y.

Arguments

Type IntentOptional Attributes Name
integer(kind=ilp), intent(in) :: n
complex(kind=dp), intent(in) :: zx(*)
integer(kind=ilp), intent(in) :: incx
complex(kind=dp), intent(out) :: zy(*)
integer(kind=ilp), intent(in) :: incy

Source Code

     pure subroutine stdlib_zcopy(n,zx,incx,zy,incy)
     !! ZCOPY copies a vector, x, to a vector, y.
        ! -- reference blas level1 routine --
        ! -- reference blas is a software package provided by univ. of tennessee,    --
        ! -- univ. of california berkeley, univ. of colorado denver and nag ltd..--
           ! Scalar Arguments 
           integer(ilp), intent(in) :: incx, incy, n
           ! Array Arguments 
           complex(dp), intent(in) :: zx(*)
           complex(dp), intent(out) :: zy(*)
        ! =====================================================================
           ! Local Scalars 
           integer(ilp) :: i, ix, iy
           if (n<=0) return
           if (incx==1 .and. incy==1) then
              ! code for both increments equal to 1
              do i = 1,n
               zy(i) = zx(i)
              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
                 zy(iy) = zx(ix)
                 ix = ix + incx
                 iy = iy + incy
              end do
           end if
           return
     end subroutine stdlib_zcopy