Clear vector

 

SZERO/DZERO/IZERO/CZERO/ZZERO

 

INTEGER*8

n, incx

 

COMPLEX*16

x(lenx)

 

CALL ZZERO(n, x, incx)

Input

n

Number of elements of vector x to be set to zero. If

 

 

n ≤ 0, the subprograms do not reference x.

 

incx

Increment for the array x, incx ≠ 0. x is stored forward

 

 

in array x with increment incx; that is, xi is stored in

 

 

x((i−1)⋅incx+1).

 

 

Use incx = 1 if the vector x is stored contiguously in

 

 

array x; that is, if xi is stored in x(i). Refer to “BLAS

 

 

Indexing Conventions” in the introduction to this

 

 

chapter.

Output

x

Array of length lenx = (n−1)⋅incx+1 containing the

 

 

n-vector x that has been set to zero. If n ≤ 0, then x is

 

 

unchanged. Otherwise, x ← 0.

Fortran Equivalent

SUBROUTINE SZERO (N, X,INCX) REAL*4 X(*)

IF ( N .LE. 0 ) RETURN IX = 1

INCXA = ABS ( INCX ) DO 10 I = 1, N

X(IX) = 0.0

IX = IX + INCXA

10CONTINUE RETURN END

Example Zero the REAL*8 vector, where x is a vector 10 elements long stored in a one-dimensional array X of dimension 20 (compare with “Example 2” in the description of SCOPY).

INTEGER*4

N,INCX

REAL*8

X(20)

N = 10

 

INCX

= 1

 

CALL

DZERO (N,X,INCX)

Chapter 2 Basic Vector Operations 151