HP MLIB User's Guide Vol. 1 7th Ed.

76 HP MLIB User’s Guide
SCLIPL/DCLIPL/ICLIPL Left sided vector clip
incy Increment for the array y, incy 0:
incy > 0 y is stored forward in array y; that is,
y
i
is stored in y((i1)×incy+1).
incy < 0 y is stored backward in array y; that
is, y
i
is stored in y((in)×incy+1).
Use incy = 1 if the vector y is stored contiguously in
array y; that is, if y
i
is stored in y(i). Refer to “BLAS
Indexing Conventions” in the introduction to this
chapter.
Output y Array of length leny = (n1)×|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 SCLIPL (N, A, X,INCX, Y,INCY)
REAL*4 A,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) = MAX ( X(IX) , A )
IX = IX + INCX
IY = IY + INCY
10 CONTINUE
RETURN
END
Example Clip the REAL*8 vector x below 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 A,X(20),Y(20)
N = 10
INCX = 1
INCY = 1
A = -1.0D0
CALL DCLIPL (N,A,X,INCX,Y,INCY)