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

Chapter 2 Basic Vector Operations 55
Search vector for element ISSVxx/IDSVxx/IISVxx/ICSVxx/IZSVxx
Output i If n 0 or if no element of x satisfies the relationship
with a specified by the subprogram name, then i = 0.
Otherwise, i is the index i of the first element x
i
of x
that satisfies the relationship with a specified by the
subprogram name. Recall that x
i
is stored in
x((i1)×|incx|+1).
Fortran
Equivalent
INTEGER*4 FUNCTION IISVEQ (N, X,INCX, A)
INTEGER*4 X(*),A
IISVEQ = 0
INCXA = ABS ( INCX )
IX = 1
DO 10 I = 1, N
IF ( X(IX) .EQ. A ) THEN
IISVEQ = I
RETURN
END IF
IX = IX + INCXA
10 CONTINUE
RETURN
END
Example Search for the first positive element of a REAL*8 vector x, where x is a vector
10 elements long stored in a one-dimensional array X of dimension 20.
INTEGER*4 I,IDSVGT,N,INCX
REAL*8 A,X(20)
N = 10
INCX = 1
A = 0.0D0
I = IDSVGT (N,X,INCX,A)