Sum of entries of a vector

F_SSUM/F_DSUM/F_CSUM/F_ZSUM

Name

F_SSUM/F_DSUM/F_CSUM/F_ZSUM

 

Sum of entries of a vector

Purpose

F_xSUM computes the sum of the entries of a vector x. If n is less than or equal

 

to zero, F_xSUM returns immediately with the output scalar r set to zero.

 

 

n – 1

 

 

r xi

 

 

i = 0

Usage

VECLIB:

 

 

INTEGER*4

INCX, N

 

REAL*4

X( * )

 

REAL*4

FUNCTION F_SSUM (N, X, INCX)

 

INTEGER*4

INCX, N

 

REAL*8

X( * )

 

REAL*8

FUNCTION F_DSUM (N, X, INCX)

 

INTEGER*4

INCX, N

 

COMPLEX*8

X( * )

 

COMPLEX*8

FUNCTION F_CSUM (N, X, INCX)

 

INTEGER*4

INCX, N

 

COMPLEX*16

X( * )

 

COMPLEX*16

FUNCTION F_ZSUM (N, X, INCX)

 

VECLIB8:

 

 

INTEGER*8

INCX, N

 

REAL*4

X( * )

 

REAL*4

FUNCTION F_SSUM (N, X, INCX)

 

INTEGER*8

INCX, N

 

REAL*8

X( * )

 

REAL*8

FUNCTION F_DSUM (N, X, INCX)

 

INTEGER*8

INCX, N

 

COMPLEX*8

X( * )

 

COMPLEX*8

FUNCTION F_CSUM (N, X, INCX)

 

INTEGER*8

INCX, N

 

COMPLEX*16

X( * )

 

COMPLEX*16

FUNCTION F_ZSUM (N, X, INCX)

Input

N

Number of elements of vector x.

Chapter 2 Basic Vector Operations 195