I have found that in a dataset I am using I get different results depending on how I tell Matlab to compute the power. If I submit the command Xpow=abs(X).^2; vs. Xpow=X.*conj(X);, I get different results. The latter is much faster to compute, but most people in my field use the former.
My question is which is more likely to be closer to the true value and why?
This difference is small in the following example of X=rand(100, 100)+rand(100,100)*i; the error approximately 10^-15. But it's larger in my actual dataset, about 10^-9. Accuracy matters in my line of research so I would like to know which is closest to the true value.
short answer: The second one will typically be both faster and more accurate, but the first one might be more practical.
long answer: Let $x = a+bi$ with $a$ and $b$ real numbers.
Then $abs(x)=\sqrt{a^2+b^2}$, so $abs(x)^2 = \sqrt{a^2 + b^2}^2$, whereas $x\cdot conj(x) = (a+bi)(a-bi)=a^2+b^2+(ab-ba)i$. You see that both expressions are sub-optimal, because they can be simplified to $a^2+b^2$. But