WHENEQ (3SCI) WHENEQ (3SCI)
NAME
WHENEQ, WHENNE - Finds all array elements equal to or not equal to the target SYNOPSIS
CALL WHENEQ(n,array ,inc ,target ,index,nval) CALL WHENNE(n,array ,inc ,target ,index,nval) DESCRIPTION
n Number of elements to be searched
array First element of the real or integer array to be searched inc Skip distance between elements of the searched array target Real or integer value searched for in the array
index Integer array containing the index of the found target in the array nval Number of values put in the index array
WHENEQ finds all real or integer array elements that are equal to a real or integer target. WHENNE returns all locations for which the relational value not equal to is true for real and integer arrays.
The Fortran equivalent follows:
INA=1 NVAL=O
IF(INC .LT. 0) INA=(-INC)*(N-l)+1 DO 100 I=I,N
IF(ARRAY(INA) .EQ. TARGEn THEN NY AL=NY AL+ 1
INDEX(NV AL)=I END IF
INA=INA+INC 100 CONTINUE
IMPLEMENTATION
These routines are available to users of both the COS and UNICOS operating systems.
SR-OI13 6-21 C
WHENFLT (3SCI) WHENFLT(3SCI)
NAME
WHENFLT, WHENFLE, WHENFGT, WHENFGE - Finds all real array elements in relation to the real target
SYNOPSIS
CALL WHENFLT(n,array,inc ,target ,index,nval) CALL WHENFLE(n,array,inc ,target,index,nval) CALL WHENFGT(n,array,inc ,target,index,nval) CALL WHENFGE(n,array,inc ,target,index,nval) DESCRIPTION
n array inc target index nval
Number of elements to be searched
First element of the real array to be searched Skip distance between elements of the searched array Real value searched for in the array
Integer array containing the index of the found target in the array Number of values put in the index array
These functions return all locations for which the relational operator is true for real arrays.
WHENFLT finds all real array elements that are less than the real target. WHENFLE finds all real array elements that are less than or equal to the real target. WHENFGT finds all real array elements that are greater than the real target. WHENFGE finds all real array elements that are greater than or equal to the real target.
IMPLEMENTATION
These routines are available to users of both the
cos
and UNICOS operating systems.SR-Ol13 6-22
c
WHENILT (3SCI) WHENILT (3SCI)
NAME
WHENIL T, WHENILE, WHENIGT, WHENIGE - Finds all integer array elements in relation to the integer target
SYNOPSIS
CALL WHENILT(n,iarray,inc,itarget,index,nval) CALL WHENILE(n,iarray ,inc ,itarget,index,nval) CALL WHENIGT(n,iarray,inc,itarget,index,nval) CALL WHENIGE(n,iarray,inc,itarget,index,nval) DESCRIPTION
n iarray inc itarget index nval
Number of elements to be searched
First element of the integer array to be searched Skip distance between elements of the searched array Integer value searched for in the array
Integer array containing the index of the found target in the array Number of values put in the index array
These functions return all locations for which the relational operator is true for integer arrays.
WHENIL T finds all integer array elements that are less than the integer target. WHENILE finds all integer array elements that are less than or equal to the integer target. WHENIGT finds all integer array elements that are greater than the integer target. WHENIGE finds all integer array elements that are greater than or equal to the integer target.
IMPLEMENTATION
These routines are available to users of both the COS and UNICOS operating systems.
SR-0113 6-23
c
WHENMEQ (3SCI) WHENMEQ (3SCI)
NAME
WHENMEQ, WHENMNE - Finds the index of occurrences equal or not equal to a scalar within a field in a vector
SYNOPSIS
CALL WHENMEQ(n,array,inc,target,index,nn,mask,right) CALL WHENMNE(n,array,inc,target,index,nn,mask,right) DESCRIPTION
n Number of elements to be searched; length of the array.
array Vector to be searched
inc Skip distance between elements of the searched array target Scalar to match logically
index Indexes in array where all logical matches with the target occurred (one based) nn Number of matches found. Length of index.
mask Mask of l' s from the right; the size of the field looked for in the table.
right Number of bits to shift right
so
as to right-justify the field searched The Fortran equivalent of WHENMEQ and WHENMNE follows:TABLE(ARRA Y(INDEX(I),I=l ,NN)).EQ.T ARGET TABLE(ARRA Y(INDEX(I),I=l ,NN)).NE.T ARGET where TABLE(X)=AND(MASK,SHIFTR(X,RIGH1))
IMPLEMENTATION
These routines are available to users of both the COS and UNICOS operating systems.
SR-Ol13 6-24
c
WHENMLT (3SCI) WHENMLT (3SCI)
NAME
WHENMLT, WHENMLE, WHENMGT, WHENMGE - Finds the index of occurrences in relation to a scalar within a field in a vector
SYNOPSIS
CALL WHENMLT{n,array,inc,target,index,nn,mask,right) CALL WHENMLE{n,array,inc,target,index,nn,mask,right) CALL WHENMGT{n,array ,inc , targe t, index, nn,mask,right) CALL WHENMGE{n,array,inc,target,index,nn,mask,right) DESCRIPTION
n Number of elements to be searched; length of the array.
array Vector to be searched
inc Skip distance between elements of the searched array target Scalar to match logically
index Indexes in array where all logical matches with the target occurred (one based) nn Number of matches found. Length of index.
mask Mask of l' s from the right; the size of the field looked for in the table.
right Number of bits to shift right so as to right-justify the field searched The Fortran equivalent of logical search performed follows:
TABLE(ARRAY(INDEX(I),I=l,NN)).LT.TARGET T ABLE(ARRAY(INDEX(I),I=l,NN)).LE.T ARGET T ABLE(ARRAY(INDEX(I),I=l,NN)).GT.T ARGET TABLE(ARRAY(INDEX(I),I=l,NN)).GE.TARGET where TABLE(X)=AND(MASK,SHIFTR(X,RIGH1))
IMPLEMENTATION
These routines are available to users of both the COS and UNICOS operating systems.
SR-Ol13 6-25
c
INTRO(3X) INTRO(3X)
7. SORTING ROUTINES
SR-OI13
There are two ways to perform a sort on files: they can be sorted using the SORT control statement or the SORT subroutines. The ORDERS routine is used to sort memory arrays rather than files.
The SORT control statement provides a generalized sort and merge capability. SORT accesses multiple input files and permits mixed key types and variable length records. It provides a variety of user-specified random access devices (such as disk, Buffer Memory Resident (BMR), and SSD solid-state storage device) and tuning parameters for performance enhancement.
The SORT program provides these capabilities through calls to the SORT subroutines. SORT subroutines provide all of the above-mentioned options and allow the use of user-supplied subroutines. For more information on SORT and its associated subroutines, see the SORT Reference Manual, eRI publication SR-0074.
ORDERS is an internal, fixed-length record sort optimized for Cray computer systems. This section gives the synopsis and description of the ORDERS routine, including several examples using ORDERS.
7-1 C