Libraries and Packages: The VOS Interface

2.6 Vector (Array) Operators -- vops


The vector operator (vops)
procedures implement common operators for arrays of most supported SPP data types. They are host-specific in the sense that they may take advantage of specialized hardware and software available on a particular system such as vector processors and vectorizing compilers. This would substantially improve the performance of computationally intensive tasks dealing with large arrays such as images. Nevertheless, the interface to SPP (the calling sequence) is independent of the underlying architecture.

Each section below describes a family of vops operators related by functionality. Each operator (procedure) is implemented with the same root name and calling sequence for several data types. However, not all operators are implemented (nor do they make sense) for every data type. The tables list the root procedure name, implemented data types, calling sequence, and description of the operation. All of the functions require an int argument that specifies the number of elements in the passed vector or vectors. If the procedure requires more than one vector, they are assumed to have the same number of elements. In nearly every case, multiple array arguments to vops procedures are also the same data type. A significant exception is achtTT(), which converts a vector of one data type to another vector of a different data type.

All vector operations may be performed in place. That is, the same array may be used on input as well as output. An array passed to a vector procedure need not be one-dimensional. In all cases, the vectors are treated simply as contiguous words. Since there is assumed to be no functional relationship among the pixel positions in the vectors, arrays of any dimensionality may be passed. Only the total number of pixels in the array need be passed to the vops procedure. Many procedures are implemented for the case of two vectors or a vector and a scalar. In the latter case, the procedure name has a k inserted before the last character (the initial of the data type) and one argument must be a constant or scalar variable.

Arithmetic Operators

These procedures implement basic arithmetic operations. The binary operators (add, subtract, multiply, and divide) include operations between two vectors or between a vector and a scalar. In the former case, each element of the output vector is the result of the operation on the corresponding elements of the input vectors. In the second case, each element of the output vector represents the result of the operation between the corresponding element of the input vector and the same scalar.

Table 2.48: Arithmetic Functions.

Each of these procedures is implemented for the following data types: short, int, long, real, double, and complex. To use the appropriate data type, replace T with the representative of the data type name, amulr() or aaddki(), for example. Most of these are the first character of the data type, except for complex, whose representative character is x. The last procedure, advzT(), implements dividing vectors, but upon dividing by zero it calls errfcn(), supplied by the application as an external function.

Bitwise Boolean operators

These procedures perform boolean operations on integer arrays, returning the same type result. The resulting vector is the result of the boolean operation on each bit of each element of the arrays.

Table 2.49: Bitwise Boolean Operators.

All of the above procedures are implemented only for the integer data types: short, int, and long.

Logical Comparison

These procedures return an int array containing the result of the logical comparison between elements of the input vectors. If the result of the comparison is true, the value in the vector is one, otherwise, it is zero.

Table 2.50: Logical Comparison Functions.

All of the above are implemented for the range of SPP data types: char, short, int, long, real, double, and complex. Note, however, that the output vector, c is always an int array.

Fundamental Array Operators

These procedures implement various basic array operations. The achtTT() procedure is unique in that the input and output vectors are of different data types. It requires two data type specifiers (t) for the input and output vectors.



Table 2.51: Fundamental Array Operators.

All of the above are implemented for the full range of SPP data types: char, short, int, long, real, double, and complex. In addition, achTT() is implemented for unsigned byte b and unsigned short u types. These are used primarily in low-level image I/O (imio) code. aclrT() is also implemented for byte.

Algebraic Operators

These procedures implement various functions. The log and square root functions include an external function passed to the procedure that sets the returned value in the case of an invalid function result such as xd6 -1.

Table 2.52: Algebraic Operators.

All of these procedures are implemented for the data types: short, int, long, real, double, and complex, except the modulus functions amodT() and amodkT(), which are not implemented for complex.

Complex Operators

These procedures involve complex operators, but involve not only complex arguments.

Table 2.53: Complex Operators.

acjgT() is implemented only for complex arrays. The first argument to aimgT() and aupxT() must be a complex array. The last argument to aupxT() must be a complex array.

Fourier Transforms

Table 2.54: Fourier Transforms.

The transform may be performed in place. The size of the arrays must be a power of two.

Transformations

Table 2.55: Transformations.

Miscellaneous Procedures

Table 2.56: Miscellaneous Procedures.

Scalar Results

These procedures return a scalar value from computation upon a vector. In most cases, the data type of the function, vector or vectors, and the returned value must match. Exceptions are aravt() and awvgt(), in which the returned value is the number of points remaining in the sample after rejection.

Table 2.57: Scalar Results.

Arithmetic Operators
Table 2.48: - Arithmetic Functions.
Bitwise Boolean operators
Table 2.49: - Bitwise Boolean Operators.
Logical Comparison
Table 2.50: - Logical Comparison Functions.
Fundamental Array Operators
Table 2.51: - Fundamental Array Operators.
Algebraic Operators
Table 2.52: - Algebraic Operators.
Complex Operators
Table 2.53: - Complex Operators.
Fourier Transforms
Table 2.54: - Fourier Transforms.
Transformations
Table 2.55: - Transformations.
Miscellaneous Procedures
Table 2.56: - Miscellaneous Procedures.
Scalar Results
Table 2.57: - Scalar Results.

Generated with CERN WebMaker