next up previous index
Next: V306 Adjusting an Up: CERNLIB Previous: V302 Copy a

V304 Search a Vector for a Given Element

Routine ID: V304
Author(s): J. Zoll, C. LetertreLibrary: KERNLIB
Submitter: Submitted: 01.03.1968
Language: Fortran or AssemblerRevised: 16.09.1991

These routines all search through a vector for a given element. The calling sequences and the default returns are different.

Structure:

FUNCTION subprograms
User Entry Names: IUCOMP, IUCOLA, IUFIND, IUFILA, IUHUNT, IULAST

Usage:

IUCOMP(IT,IVEC,N)or IUCOLA(IT,IVEC,N)

returns the relative address in the array IVEC of the first (or the last) word which is equal to IT, or zero if IT is not contained in IVEC(1),...,IVEC(N) or if N=0 .
IUFIND(IT,IVEC,JL,JR)or IUFILA(IT,IVEC,JL,JR)

returns the relative address in the array IVEC of the first (or the last) element between IVEC(JL) and IVEC(JR) (JL ≤JR) which equals IT, or JR+1

if IT is not contained in IVEC(JL),IVEC(JL+1),..., IVEC(JR) or if JL > JR .

    IUHUNT(IT,IVEC,N,INC)
returns the relative address of the first word among IVEC(1),IVEC(INC+1),IVEC(2*INC+1),... of array IVEC (the search does not go beyond IVEC(N)) which equals IT, or zero if IT is not found or if N=0 .
    IULAST(IT,IVEC,N)
returns the relative address of the last word which, in the array IVEC of N elements, is not equal to IT, or zero if N=0 or if all elements in IVEC equal IT.

Notes:

IVEC and IT above may be of type INTEGER or REAL, but the comparison is done in type INTEGER.

V306


Janne Saarela
Mon Apr 3 15:06:23 METDST 1995