Re: Using Fourier and InverseFourier instead of Convolve
- To: mathgroup at smc.vnet.net
- Subject: [mg85958] Re: Using Fourier and InverseFourier instead of Convolve
- From: "Solomon, Joshua" <J.A.Solomon at city.ac.uk>
- Date: Thu, 28 Feb 2008 02:59:56 -0500 (EST)
- References: <fpooi0$1cg$1@smc.vnet.net> <fq0u59$k8l$1@smc.vnet.net>
First, let me thank all who responded to my query! Second, no, Daniel, your code works fine for me. Finally, FWIW here is code that does what I really wanted, which was to quickly convolve a long list of lists (each having the same length). Possibly not the most elegant code ever, but it works, as I said, FWIW: cv[listOfLists_]:=With[{dims=Dimensions[listOfLists]}, (dims[[1]]dims[[2]]-dims[[1]]+1)^((dims[[1]]-1)/2) InverseFourier[Times[##]]&@@( Fourier[PadRight[#,dims[[1]]dims[[2]]-dims[[1]]+1] ]&/@listOfLists)] On 26/2/08 11:45, in article fq0u59$k8l$1 at smc.vnet.net, "dh" <dh at metrohm.ch> wrote: > d1 = Table[If[Abs[i] < 3, 1, 0], {i, -5, 5}]; > > ListLinePlot[{InverseFourier[Fourier[d1] Fourier[d1 ]] Sqrt[10] ,d1}] > > ListLinePlot[{ListConvolve[d1, d1, 1], d1}] > > ListLinePlot[{ListConvolve[d1, d1, -1], d1}] > > Note that the innocent code above crashes my mathematica kernel (version > > 6.1, does this happen to you too? )