DSPF_sp_dotp_sqr
4.5 Math
DSPF_sp_dotp_sqr
Function
Arguments
Description
Algorithm
Special Requirements There are no special alignment requirements.
Implementation Notes
4-52
Single-precision dot product and sum of square
float DSPF_sp_dotp_sqr (float G, const float * x, const float * y, float * restrict
r, int nx)
G
Sum of y-squared initial value.
x[nx]
Pointer to first input array.
y[nx]
Pointer to second input array.
r
Pointer to output for accumulation of x[]*y[].
nx
Length of input vectors.
This routine computes the dot product of x[] and y[] arrays,adding it to the value
in the location pointed to by r. Additionally, it computes the sum of the squares
of the terms in the y array, adding it to the argument G. The final value of G is
given as the return value of the function.
This is the C equivalent of the assembly code. Note that the assembly code
is hand optimized and restrictions may apply.
float DSPF_sp_dotp_sqr(float G, const float * x, const float *
y,
{
int i;
for (i = 0; i < nx; i++)
{
*r += x[i] * y[i];
G += y[i] * y[i];
}
return G;
}
-
Multiple assignment was used to reduce loop carry path.
-
Endianess: This code is endian neutral.
-
Interruptibility: This code is interrupt-tolerant but not interruptible.
float *restrict r, int nx)
/* Compute Dot Product */
/* Compute Square
*/
Need help?
Do you have a question about the TMS320C67 DSP Series and is the answer not in the manual?
Questions and answers