Re: Compile Fourier
- To: mathgroup at smc.vnet.net
- Subject: [mg64906] Re: Compile Fourier
- From: Peter Pein <petsie at dordos.net>
- Date: Tue, 7 Mar 2006 06:11:58 -0500 (EST)
- References: <duh209$5kq$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
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 :-)