I need to compute the dot product of two complex vectors x and y, i.e, the transpose of the complex conjugate of x times y, (x,y) = sum(x_real[n] * y_real[n] + x_imag[n] * y_imag[n]) + j * sum(x_real[n] * y_real[n] - x_imag[n] * y_imag[n]) . (1) I was trying to use the function DSPF_sp_dotp_cplx in C67xdsplib. But I found that this function compute the dot product in a different way. Its definition of dot product of two complex vectors x and y is the product of the transpose of x times y, i.e.,
(x,y) = sum(x_real[n] * y_real[n] - x_imag[n] * y_imag[n]) + j * sum(x_real[n] * y_real[n] + x_imag[n] * y_imag[n]) . (2) See below for definition of this function from TMS320C67X DSP Library Programmer’s Reference Guide. Anyway I suggestion on what I can do to compute the dot product in (1)?
This is the C equivalent for the assembly code. Note that the assembly code is hand optimized and restrictions may apply. void DSPF_sp_dotp_cplx(const float* x, const float* y, int n, float* restrict re, float* restrict im) { float real=0, imag=0; int i=0; for(i=0; i<n; i++)
{ real+=(x[2*i]*y[2*i] − x[2*i+1]*y[2*i+1]);
imag+=(x[2*i]*y[2*i+1] + x[2*i+1]*y[2*i]); } *re=real; *im=imag;