stdlib_zdotc Function

public pure function stdlib_zdotc(n, zx, incx, zy, incy)

ZDOTC forms the dot product of two complex vectors ZDOTC = X^H * 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(in) :: zy(*)
integer(kind=ilp), intent(in) :: incy

Return Value complex(kind=dp)


Source Code

     pure complex(dp) function stdlib_zdotc(n,zx,incx,zy,incy)
     !! ZDOTC forms the dot product of two complex vectors
     !! ZDOTC = X^H * 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(*), zy(*)
        ! =====================================================================
           ! Local Scalars 
           complex(dp) :: ztemp
           integer(ilp) :: i, ix, iy
           ! Intrinsic Functions 
           intrinsic :: conjg
           ztemp = (0.0_dp,0.0_dp)
           stdlib_zdotc = (0.0_dp,0.0_dp)
           if (n<=0) return
           if (incx==1 .and. incy==1) then
              ! code for both increments equal to 1
              do i = 1,n
                 ztemp = ztemp + conjg(zx(i))*zy(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
                 ztemp = ztemp + conjg(zx(ix))*zy(iy)
                 ix = ix + incx
                 iy = iy + incy
              end do
           end if
           stdlib_zdotc = ztemp
           return
     end function stdlib_zdotc