DSP_dotprod
DSP_dotprod | Vector Dot Product | |||
Function |
| int DSP_dotprod(const short * restrict x, const short * restrict y, int nx) |
| |
Arguments |
| x[nx] | First vector array. Must be | |
|
| y[nx] | Second vector array. Must be double | |
|
| nx | Number of elements of vector. Must be multiple of 4. | |
|
| return int | Dot product of x and y. | |
Description |
| This routine takes two vectors and calculates their dot product. The inputs are | ||
|
| |||
Algorithm |
| This is the C equivalent of the assembly code without restrictions. Note that | ||
|
| the assembly code is hand optimized and restrictions may apply. |
int DSP_dotprod(short x[ ],short y[ ], int nx)
{
int sum; int i; sum = 0;
for(i=0; i<nx; i++){ sum += (x[i] * y[i]);
}
return (sum);
}
Special Requirements
-The input length must be a multiple of 4.
-The input data x[ ] and y[ ] are stored on
-To avoid bank conflicts, the input arrays x[ ] and y[ ] must be offset by 4