scasum Function

public function scasum(n, cx, incx)

NAME

scasum(3f) - [BLAS:SINGLE_BLAS_LEVEL1] SCASUM:=SUM(I=1 to N) ABS(REAL(CX(I)))+ABS(AIMAG(CX(I))).

SYNOPSIS

 real function scasum(n,cx,incx)

   .. Scalar Arguments ..
   integer,intent(in)    :: incx,n
   ..
   .. Array Arguments ..
   complex,intent(inout) :: cx(*)
   ..

DEFINITION

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

OPTIONS

N

       N is INTEGER
      number of elements in input vector(s)

CX

       CX is COMPLEX array, dimension ( 1 + ( N - 1 )*abs( INCX ) )

INCX

       INCX is INTEGER
      storage spacing between elements of SX

AUTHORS

  • Univ. of Tennessee
  • Univ. of California Berkeley
  • Univ. of Colorado Denver
  • NAG Ltd.

date:November 2017

FURTHER DETAILS

  jack dongarra, linpack, 3/11/78.
  modified 3/93 to return if incx .le. 0.
  modified 12/3/93, array(1) declarations changed to array(*)

SEE ALSO

Online html documentation available at
http://www.netlib.org/lapack/explore-html/

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: n
complex, intent(inout) :: cx(*)
integer, intent(in) :: incx

Return Value real


Contents

Source Code


Variables

Type Visibility Attributes Name Initial
integer, public :: i
integer, public :: nincx
real, public :: stemp

Source Code

real function scasum(n,cx,incx)
implicit none
!
!  -- Reference BLAS level1 routine (version 3.8.0) --
!  -- Reference BLAS is a software package provided by Univ. of Tennessee,    --
!  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
!     November 2017
!
!     .. Scalar Arguments ..
      integer,intent(in)    :: incx,n
!     ..
!     .. Array Arguments ..
      complex,intent(inout) :: cx(*)
!     ..
!  =====================================================================
!     .. Local Scalars ..
      real stemp
      integer i,nincx
!     ..
!     .. Intrinsic Functions ..
      intrinsic abs,aimag,real
!     ..
      scasum = 0.0e0
      stemp = 0.0e0
      if (n.le.0 .or. incx.le.0) return
      if (incx.eq.1) then
!
!        code for increment equal to 1
!
         do i = 1,n
            stemp = stemp + abs(real(cx(i))) + abs(aimag(cx(i)))
         enddo
      else
!
!        code for increment not equal to 1
!
         nincx = n*incx
         do i = 1,nincx,incx
            stemp = stemp + abs(real(cx(i))) + abs(aimag(cx(i)))
         enddo
      endif
      scasum = stemp

end function scasum