stdlib_dzasum Function

public pure function stdlib_dzasum(n, zx, incx)

DZASUM takes the sum of the (|Re(.)| + |Im(.)|)'s of a complex vector and returns a double precision result.

Arguments

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

Return Value real(kind=dp)


Source Code

     pure real(dp) function stdlib_dzasum(n,zx,incx)
     !! DZASUM takes the sum of the (|Re(.)| + |Im(.)|)'s of a complex vector and
     !! returns a double precision result.
        ! -- 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, n
           ! Array Arguments 
           complex(dp), intent(in) :: zx(*)
        ! =====================================================================
           ! Local Scalars 
           real(dp) :: stemp
           integer(ilp) :: i, nincx
           stdlib_dzasum = zero
           stemp = zero
           if (n<=0 .or. incx<=0) return
           if (incx==1) then
              ! code for increment equal to 1
              do i = 1,n
                 stemp = stemp + stdlib_cabs1(zx(i))
              end do
           else
              ! code for increment not equal to 1
              nincx = n*incx
              do i = 1,nincx,incx
                 stemp = stemp + stdlib_cabs1(zx(i))
              end do
           end if
           stdlib_dzasum = stemp
           return
     end function stdlib_dzasum