MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Fourier: Execution time for real and complex arguments


Hi,

Sorry for asking these first questions a little
bit prematurely!

Martin Johansson wrote (sent by Silvia Raffaelli):
>
> I am a little curious about the behavior of the
> DFT-routine Fourier. Two questions:
>
> 1. Why does Fourier take much more than twice the time
>    to calculate the DFT of a list of imaginary/complex
>    numbers compared to a equal-length list of real
>    numbers (floating-point)?
>
> 2. Why does the way I generate a list affect the
>    time it takes to run Fourier?

OK, to answer my own question: It's related to whether
the argument is a packed array or not.

The following sample session shows the behavior for
different operations:

<<Developer`
n=2^10;
PackedArrayQ[Table[Random[],{i,n}]]
PackedArrayQ[Table[Random[],{i,n}] + I 1]
PackedArrayQ[Table[Random[],{i,n}] + I 1.]
PackedArrayQ[     I Table[Random[] ,{i,n}]]
PackedArrayQ[1  + I Table[Random[] ,{i,n}]]
PackedArrayQ[1. + I Table[Random[] ,{i,n}]]

Out[2] = True
Out[3] = False
Out[4] = True
Out[5] = False
Out[6] = False
Out[7] = False

Is this what most people would expect? Is the difference
in behavior for real and imaginary/complex numbers inherent
in the packed array representation? But then, how do
I understand 'Out[4]'?

In conclusion: Which operations produce packed arrays,
and which don't?

TIA,

Martin

--
Martin Johansson
Ericsson Microwave Systems
m.johansson at ericsson.com




  • Prev by Date: Re: Matrix of possible combinations of N elements
  • Next by Date: Fit[] versus Regress[] inconsistent behahiour
  • Previous by thread: Fourier: Execution time for real and complex arguments
  • Next by thread: Re: Fourier: Execution time for real and complex arguments