Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

IDAMAX(3C)  —  Kubota Pacfic Computer Inc. (C Programming Language Functions)

NAME

IDAMAX − a set of routines to find the index in an array of the element having largest or smallest value

SYNOPSIS

int_IDAFMAX(count, array, stride)
double ∗array;
int count, stride;

DESCRIPTION

These functions are available for finding the index in an array of the element having the greatest or smallest value:

_IDAFMAX
_IDAFMIN
_IDALMAX
_IDALMIN
_IDFMAX
_IDFMIN
_IDLMAX
_IDLMIN
_IIAFMAX
_IIAFMIN
_IIALMAX
_IIALMIN

_IIFFMAX
_IIFMIN
_IILMAX
_IILMIN
_ISAFMAX
_ISAFMIN
_ISALMAX
_ISALMIN
_ISFMAX
_ISFMIN
_ISLMAX
_ISLMIN

The name of the function determines the type of array searched and which element is returned by the following convention:

(1)The third letter of each function name determines the type of array which is searched. A "d" indicates that the routine expects a double ∗ as the first parameter; an "s" indicates that the routine expects a float ∗; and a "i" indicates that the routine expects a int ∗. 

(2)If the next letter in the routine name is an "a", then the routine takes the absolute value of all the elements before searching. 

(3)The next letter is always either an "f" or an "l."  An "f" indicates that the routine returns the first occurence in the case of duplicates; an "l" indicates that the routine returns the last occurence. 

(4)Finally, the last three letters of "min" or "max" indicates whether the routine searches for a maximum value or a minimum value. 

The parameter count indicates the number of elements of the array to search, and the parameter stride indicates the stride to use in stepping through array. 

The following calls should clarify the use of these routines.  Assume the array contains the following double precision values:

1.0, 2.0, 3.0, -2.0, -1.0

(1)_IDAFMIN(5,a,1) returns 0 because both the first and last elements have the smallest absolute value, and the function returns the index of the first. 

(2)_IDALMIN(5,a,1) returns 4 because the last element with the smallest absolute value is element 4. 

(3)_IDFMIN(5,a,1) returns 3 because -2.0 is the smallest element. 

(4)_IDFMIN(3,a,2) returns 2 because -1.0 is the smallest of elements 1, 3, and 5.  Note that the return value does not consider the stride; it returns the offset within the passed-in array. 

These files use the Titan 1500/3000 vector hardware to perform the necessary computations very rapidly.  Their unusual names result because calls to them are automatically generated by the compiler; however, there should be no problems with users calling them. 

CAVEATS

Comparison against NaN is undefined on Titan 1500/3000; hence calling these routines on a vector that contains NaN’s may give unexpected results.  Note that these are not vector-valued functions, as are most Titan 1500/3000 math routines, so that they take the address of a vector in memory and not a vector register. 

September 02, 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026