MathGroup Archive 2006

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

Search the Archive

Re: Compile Fourier


Alberto Verga schrieb:
> The following piece of code gives an error message 'Compiled expression 
> should be a rank 1 tensor of machine-size complex numbers'
> 
>     Compile[{{m, _Real, 2}}, Fourier[m]][Table[N[i - j], {i, 4}, {j, 4}]]
> 
> Does this mean that Fourier[] cannot be compiled with rank 2 arrays?
> My goal is to write a pseudospectral code to solve 2D PDE: compiling the 
> time loop seems unavoidable if one wants reasonable performance.
> 
> Thanks.
> 
> Alberto Verga.
> Alberto.Verga at irphe.univ-mrs.fr
> 
> 
> 
> 
In[1]:=
Compile[{{m,_Real,2}},Fourier[m],{{_Fourier,_Complex,2}}][Table[N[i-j],{i,4},{j,4}]]
Out[1]=
{{0. + 0.*I, 2. + 2.*I, 2. + 0.*I, 2. - 2.*I}, {-2. - 2.*I, 0. + 0.*I, 0. + 0.*I, 0. + 0.*I},
   {-2. + 0.*I, 0. + 0.*I, 0. + 0.*I, 0. + 0.*I}, {-2. + 2.*I, 0. + 0.*I, 0. + 0.*I, 0. + 0.*I}}

works :-)


  • Prev by Date: Re: Numerical solutions of SDE
  • Next by Date: Bizarre results with TreePlot
  • Previous by thread: Compile Fourier
  • Next by thread: Re: Compile Fourier