?iso-8859-1?Q?J=FCrgen?= v.Hagen wrote:
>the filters are for real and imaginary the same. However, I thought that
>you'd save quite a few operations if you work only on real and the
>imaginary part seperatly.
>
>mat is complex, filter is real, so a multiplication promotes the filter
>to complex, meaning that you'd need 4 multiplies and 2 adds, whereas
>you really only need 2 multiplies.
Why do you think "promotion" is required?
>Question arising:
>- is the memory jugling worth it?
No.
>- are compilers really promoting to complex where you would
>need less operations? (I think the standard requires promotion?)
No and no. The standard says that the result of REAL*COMPLEX is COMPLEX.
It's quite straightforward: REAL*COMPLEX is going to do 2 multiplications
on any non-pessimising compiler. Similarly COMPLEX*REAL. One might even
expect COMPLEX/REAL just to do the 2 divisions (or even one reciprocal and
two multiplications if that is faster and people don't care about the
extra rounding error).
Cheers.
--
...........................Malcolm Cohen, NAG Ltd., Oxford, U.K.
([log in to unmask])
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|