2.2 Additional Remarks

The description of the functions limits its scope of what could be considered the regular usage of these operations. However, since no boundary checking is performed during computation of these functions, operations and its results are interpreted to fit specific needs.

For instance, while computing the VectorMax function, the length of the source vector could be greater than numElems. In this case, the function would be used to find the maximum value only among the first numElems elements of the source vector.

Similarly, if the requirement is to replace numElems elements of a destination vector located between N and N+numElems-1, with numElems elements from a source vector located between elements M and M+numElems-1, then, the VectorCopy function could be used as follows:

 

fractional* dstV[DST_ELEMS] = {...}; 
fractional* srcV[SRC_ELEMS] = {...}; 

int n = NUM_ELEMS; 
int N = N_PLACE;   /* NUM_ELEMS+N ≤ DST_ELEMS */ 
int M = M_PLACE;   /* NUM_ELEMS+M ≤ SRC_ELEMS */ 

fractional* dstVector = dstV+N; 
fractional* srcVector = srcV+M; 

dstVector = VectorCopy (n, dstVector, srcVector); 

 

Also in this context, the VectorZeroPad function can operate in place, where dstV = srcV, numElems is the number of elements at the beginning of the source vector to preserve, and numZeros is the number of elements at the vector tail to set to zero. Other possibilities can be exploited from the fact that no boundary checking is performed.