MathGroup Archive 2006

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

Search the Archive

Compile Fourier (2)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg64877] Compile Fourier (2)
  • From: Alberto Verga <Alberto.Verga at laposte.net>
  • Date: Mon, 6 Mar 2006 05:01:36 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

(Please, forget my last question, the answer is in the third argument of 
Compile; but...)
Someone could explain why the compiled version is slower than the uncompiled 
one in the following example?

(* Compiled *)
cf = Compile[{{m, _Complex, 2}}, Module[{a, b = {m}}, a = m;
Do[a = a + Fourier[Re[InverseFourier[m]]]; AppendTo[b, a];, {100}];
Return[Re[b]]], {{Fourier[_], _Complex,
2}, {InverseFourier[_], _Complex, 2}}]

mm = cf[Table[N[i - j], {i, 64}, {j, 64}]]; // Timing
{2.654 Second, Null}

(*Uncompiled*)

f[m_] := Module[{a, b = {m}}, a = m;
Do[a = a + Fourier[Re[InverseFourier[m]]]; AppendTo[b, a];, {100}];
Return[Re[b]]];

mmf = f[Table[N[i - j], {i, 64}, {j, 64}]]; // Timing
{0.35 Second, Null}

Thanks,

Alberto Verga
Alberto.Verga at irphe.univ-mrs.fr





  • Prev by Date: Re: 3D voronoi problem in mathematica
  • Next by Date: Re: Extract values and multilpicities from list
  • Previous by thread: Re: Plus Behavior Inside a Notation Box?
  • Next by thread: Re: Compile Fourier (2)