Recently I've been checking out the CMSIS DSP complex math functions library and I've seen something I cannot fully comprehend, thus my first post on SO.
最近我一直在查看CMSIS DSP复杂的数学函数库,我看到了一些我无法完全理解的东西,因此我的第一个帖子是这样的。
What I'm unable to grasp is how the he11 can the complex dot product function yeild a proper result? The function may be found here: Complex Dot Product
我无法理解的是he11怎么能把复杂的点积函数变成一个合适的结果呢?函数可以在这里找到:复数点积
As far as I'm concerned the part
就我而言
for(n=0; n<numSamples; n++) {
realResult += pSrcA[(2*n)+0]*pSrcB[(2*n)+0] - pSrcA[(2*n)+1]*pSrcB[(2*n)+1];
imagResult += pSrcA[(2*n)+0]*pSrcB[(2*n)+1] + pSrcA[(2*n)+1]*pSrcB[(2*n)+0];
}
is A-okay, but how's that:
很好,但是怎么样:
/* CReal = A[0]* B[0] + A[2]* B[2] + A[4]* B[4] + .....+ A[numSamples-2]* B[numSamples-2] */
real_sum += (*pSrcA++) * (*pSrcB++);
/* CImag = A[1]* B[1] + A[3]* B[3] + A[5]* B[5] + .....+ A[numSamples-1]* B[numSamples-1] */
imag_sum += (*pSrcA++) * (*pSrcB++);
supposed to work, since it misses the product of real*imag parts of the samples?
应该可以工作,因为它错过了真实*imag部分的产品的样品?
It might - and most probably is - a really dumb question, but somehow I simply cannot see it working.
这可能是一个非常愚蠢的问题,但不知何故,我就是看不出它在起作用。
1 个解决方案
#1
1
That looks simply wrong, and the implementation doesn't match the description.
这看起来是错误的,而且实现不符合描述。
Suppose we have z = x + i*y
and w = u + i*v
with x, y, u, v
real. Then
假设我们有z = x + i*y和w = u + i*v和x, y, u, v实数。然后
z*w = (x + i*y)*(u + i*v) = (x*u - y*v) + i*(x*v + y*u)
and
和
z*conjugate(w) = (x + i*y)*(u - i*v) = (x*u + y*v) + i*(y*u - x*v)
So with the loop
如此循环
while(blkCnt > 0u)
{
/* CReal = A[0]* B[0] + A[2]* B[2] + A[4]* B[4] + .....+ A[numSamples-2]* B[numSamples-2] */
real_sum += (*pSrcA++) * (*pSrcB++);
/* CImag = A[1]* B[1] + A[3]* B[3] + A[5]* B[5] + .....+ A[numSamples-1]* B[numSamples-1] */
imag_sum += (*pSrcA++) * (*pSrcB++);
/* Decrement the loop counter */
blkCnt--;
}
you will get real_sum + imag_sum = Real part of hermitian inner product
finally.
你最终会得到真实和+ imag_sum =厄米特内积的实部。
Neither real_sum
nor imag_sum
is in any simple way related to the real/imaginary part of the inner product nor the bilinear product.
无论是real_sum还是imag_sum都与内积的实/虚部或双线性积没有任何联系。
#1
1
That looks simply wrong, and the implementation doesn't match the description.
这看起来是错误的,而且实现不符合描述。
Suppose we have z = x + i*y
and w = u + i*v
with x, y, u, v
real. Then
假设我们有z = x + i*y和w = u + i*v和x, y, u, v实数。然后
z*w = (x + i*y)*(u + i*v) = (x*u - y*v) + i*(x*v + y*u)
and
和
z*conjugate(w) = (x + i*y)*(u - i*v) = (x*u + y*v) + i*(y*u - x*v)
So with the loop
如此循环
while(blkCnt > 0u)
{
/* CReal = A[0]* B[0] + A[2]* B[2] + A[4]* B[4] + .....+ A[numSamples-2]* B[numSamples-2] */
real_sum += (*pSrcA++) * (*pSrcB++);
/* CImag = A[1]* B[1] + A[3]* B[3] + A[5]* B[5] + .....+ A[numSamples-1]* B[numSamples-1] */
imag_sum += (*pSrcA++) * (*pSrcB++);
/* Decrement the loop counter */
blkCnt--;
}
you will get real_sum + imag_sum = Real part of hermitian inner product
finally.
你最终会得到真实和+ imag_sum =厄米特内积的实部。
Neither real_sum
nor imag_sum
is in any simple way related to the real/imaginary part of the inner product nor the bilinear product.
无论是real_sum还是imag_sum都与内积的实/虚部或双线性积没有任何联系。