DSP Library
2004 Microchip Technology Inc. Advance Information DS51456A-page 13
2.4 VECTOR FUNCTIONS
This section presents the concept of a fractional vector, as considered by the DSP
Library, and describes the individual functions which perform vector operations.
2.4.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 (two bytes) is used to store the value of each element, and this quantity
must be interpreted as a fractional number represented in the 1.15 data format.
A pointer addressing the first element of the vector is used as a handle which provides
access to each of the vector values. The address of the first element is referred to as
the base address of the vector. Because each element of the vector is 16 bits, the base
address must be aligned to an even address.
The one dimensional arrangement of a vector accommodates to the memory storage
model of the device, so that the n-th element of an N-element vector can be accessed
from the vector's base address BA as:
BA + 2(n-1), for 1 ≤ n ≤ N.
The factor of 2 is used because of the byte addressing capabilities of the dsPIC30F
device.
Unary and binary fractional vector operations are implemented in this library. The
operand vector in a 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.15 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 resulting 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 such 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:
a) 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.
b) In the case of binary operations, the cardinalities of both operand vectors must
obey the rules of vector algebra (particularly, see remarks for the
VectorConvolve and VectorCorrelate functions).
c) The destination vector must be large enough to accept the results of an
operation.