Two sided vector clip

SCLIP/DCLIP/ICLIP

Name SCLIP/DCLIP/ICLIP

Two sided vector clip

Purpose Given scalars a and b and a vector x of length n, these subprograms form the vector y by the clip operation

 

a

if

xi a

 

yi

 

a < xi < b

i = 1, 2, …, n

= xi

if

 

 

b xi

 

 

b

if

 

The vectors can be stored in one-dimensional arrays or in either rows or columns of two-dimensional arrays. Indexing through the arrays can be either forward or backward.

Usage

VECLIB:

 

 

INTEGER*4

n, incx, incy

 

REAL*4

a, b, x(lenx), y(leny)

 

CALL SCLIP(n, a, b, x, incx, y, incy)

 

INTEGER*4

n, incx, incy

 

REAL*8

a, b, x(lenx), y(leny)

 

CALL DCLIP(n, a, b, x, incx, y, incy)

 

INTEGER*4

n, incx, incy, a, b, x(lenx), y(leny)

 

CALL ICLIP(n, a, b, x, incx, y, incy)

 

VECLIB8:

 

 

INTEGER*8

n, incx, incy

 

REAL*4

a, b, x(lenx), y(leny)

 

CALL SCLIP(n, a, b, x, incx, y, incy)

 

INTEGER*8

n, incx, incy

 

REAL*8

a, b, x(lenx), y(leny)

 

CALL DCLIP(n, a, b, x, incx, y, incy)

 

INTEGER*8

n, incx, incy, a, b, x(lenx), y(leny)

 

CALL ICLIP(n, a, b, x, incx, y, incy)

Input

n

Number of elements of vectors x and y to be used. If

 

 

n 0 , the subprograms do not reference x or y.

 

a

The scalar a.

 

b

The scalar b.

Chapter 2 Basic Vector Operations 71