Right sided vector clip

 

 

SCLIPR/DCLIPR/ICLIPR

 

incy

Increment for the array y, incy ≠ 0:

 

 

incy > 0

y is stored forward in array y; that is,

 

 

 

yi is stored in y((i−1)⋅incy+1).

 

 

incy < 0

y is stored backward in array y; that

 

 

 

is, yi is stored in y((in)⋅incy+1).

 

 

Use incy = 1 if the vector y is stored contiguously in

 

 

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

 

 

Indexing Conventions” in the introduction to this

 

 

chapter.

 

Output

y

Array of length leny = (n−1)⋅incy+1 containing the

 

 

n-vector y. If n ≤ 0, then y is unchanged. Otherwise, y is

set as specified in “Purpose.”

Notes x and y can be the same array if incx = incy. Otherwise, the result is unspecified if x and y overlap such that any element of x shares a memory location with any element of y.

Fortran Equivalent

SUBROUTINE SCLIPR (N, B, X,INCX, Y,INCY) REAL*4 B,X(*),Y(*)

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

IY = 1

IF ( INCX .LT. 0 ) IX = 1 - (N-1) * INCX IF ( INCY .LT. 0 ) IY = 1 - (N-1) * INCY DO 10 I = 1, N

Y(IY) = MIN ( X(IX) , B ) IX = IX + INCX

IY = IY + INCY

10CONTINUE RETURN END

Example

Clip the REAL*8 vector x above 1 into y, where x and y are vectors 10 elements

 

long stored in one-dimensional arrays X and Y of dimension 20.

 

INTEGER*4 N,INCX,INCY

 

REAL*8

B,X(20),Y(20)

 

N = 10

 

 

INCX

= 1

 

 

INCY

= 1

 

 

B =

1.0D0

 

 

CALL

DCLIPR (N,B,X,INCX,Y,INCY)

Chapter 2 Basic Vector Operations 79