MathGroup Archive 2006

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

Search the Archive

Re: Compile Fourier

  • To: mathgroup at smc.vnet.net
  • Subject: [mg64899] Re: Compile Fourier
  • From: Paul Abbott <paul at physics.uwa.edu.au>
  • Date: Tue, 7 Mar 2006 06:11:49 -0500 (EST)
  • Organization: The University of Western Australia
  • References: <duh209$5kq$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

In article <duh209$5kq$1 at smc.vnet.net>,
 Alberto Verga <Alberto.Verga at laposte.net> wrote:

> 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?

The error message is avoided by specifying the type for Fourier[m]:

  cf = Compile[{{m, _Real, 2}}, Fourier[m], 
    {{Fourier[_], _Complex, 2}}][Table[N[i - j], {i, 4}, {j, 4}]]

However, timing shows no speed-up compared to direct use of Fourier. And 
an examination of the compiled function shows that Fourier is _not_ 
compiled:

  cf[[-3]]

> My goal is to write a pseudospectral code to solve 2D PDE: compiling the 
> time loop seems unavoidable if one wants reasonable performance.

Rob Knapp gave a talk on the Split Step Fourier Method. See the gzipped 
file NLS.tgz in

  http://members.wri.com/rknapp/Talks/IMS/

This has the code to do this using arbitrary time order.

Cheers,
Paul

_______________________________________________________________________
Paul Abbott                                      Phone:  61 8 6488 2734
School of Physics, M013                            Fax: +61 8 6488 1014
The University of Western Australia         (CRICOS Provider No 00126G)    
AUSTRALIA                               http://physics.uwa.edu.au/~paul


  • Prev by Date: Re: Possible Bug in ArcTan ?
  • Next by Date: Re: Compile Fourier (2)
  • Previous by thread: Re: Compile Fourier
  • Next by thread: Plus Behavior Inside a Notation Box?