       Re: Fourier: Execution time for real and complex arguments

• To: mathgroup at smc.vnet.net
• Subject: [mg31833] Re: Fourier: Execution time for real and complex arguments
• From: Silvia Raffaelli <silviar at elmagn.chalmers.se>
• Date: Fri, 7 Dec 2001 05:55:45 -0500 (EST)
• Organization: Chalmers University of Technology
• References: <9ul29u\$6lr\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```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 = True
Out = False
Out = True
Out = False
Out = False
Out = 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'?

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