2.1 Fractional Vector Operations
A fractional vector is a collection of numerical values, the vector elements, allocated contiguously in memory, with the first element at the lowest memory address. One word of memory is used to store the value of each element, and this quantity must be interpreted as a fractional number represented in 1.31 data format.
The pointer addressing the first element of the vector serves as a handle, granting access to each value within the vector. This address of the first element is known as the base address (BA) of the vector. Given that each vector element is 32-bits (for 1.31 fractional data), the last 2-bits of the base address must be zero.
The one-dimensional arrangement of a vector accommodates to the memory storage model of the device, so that the nth element of an N-element vector can be accessed from the vector's base address as:
BA + 4*(n – 1), for 1 ≤ n ≤ N.
Unary and binary fractional vector operations are implemented in this library. The operand vector in an unary operation is called the source vector. In a binary operation, the first operand is referred to as the source one vector and the second as the source two vector. Each operation applies some computation to one or several elements of the source vector(s). Some operations produce a result which is a scalar value (also to be interpreted as a 1.31 fractional number), while other operations produce a result which is a vector. When the result is also a vector, this is referred to as the destination vector.
Some operations, that result in a vector, allow computation in place. This means the results of the operation are placed back into the source vector (or the source one vector for binary operations). In this case, the destination vector is said to (physically) replace the source (one) vector. If an operation can be computed in place, it is indicated as such in the comments provided with the function description.
For some binary operations, the two operands can be the same (physical) source vector, which means the operation is applied to the source vector and itself. If this type of computation is possible for a given operation, it is indicated as self-applicable in the comments provided with the function description.
Some operations can be both self-applicable and computed in place.
All the fractional vector operations in this library take as an argument the cardinality (number of elements) of the operand vector(s). Based on the value of this argument, the following assumptions are made:
- The sum of sizes of all the vectors involved in a particular operation falls within the range of available data memory for the target device.
- In the case of binary operations, the cardinalities of both operand vectors must obey the rules of vector algebra (specifically for the VectorConvolve and VectorCorrelate functions).
- The destination vector must be large enough to accept the results of an operation.