comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: FFT in 1 dimension
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: FFT in 1 dimension [message #28492] Fri, 07 December 2001 20:09
Paul Woodford is currently offline  Paul Woodford
Messages: 43
Registered: June 2000
Member
From the What's New in IDL 5.5 document at
<http://www.rsinc.com/idl/whatsnew.cfm>:

New Dimension-specific Transforming for FFT

Paul
Re: FFT in 1 dimension [message #28494 is a reply to message #28492] Fri, 07 December 2001 13:41 Go to previous message
Wayne Landsman is currently offline  Wayne Landsman
Messages: 117
Registered: January 1997
Senior Member
hradilv.nospam@yahoo.com wrote:

> Here's what I came up with. Any comments?

I haven't examined your code in detail, but there is one line where the
speed of the program can be improved significantly:

Instead of writing

for i=0, nlines-1 do fdata[*,i] = fft(fdata[*,i],inverse=inverse)

write

for i=0, nlines-1 do fdata[0,i] = fft(fdata[*,i],inverse=inverse)

I'm actually not sure why this speed things up. I suppose by writing
fdata[0,i] on the left hand side, you've directly specified a starting
location to place the computation, but if you instead write fdata[*,i]
then IDL first extracts a temporary variable, assigns it to the value of
the computation, and then writes the temporary variable back into
fdata. Still, I would think that the compiler could recognize that
these two notations are equivalent.

--Wayne Landsman landsman@mpb.gsfc.nasa.gov
Re: FFT in 1 dimension [message #28498 is a reply to message #28494] Fri, 07 December 2001 12:10 Go to previous message
hradilv.nospam is currently offline  hradilv.nospam
Messages: 19
Registered: November 2001
Junior Member
OOPS - I think this one works:

function ft1d, data, dim, inverse=inverse

ds = size(data)
ndim = ds[0]
nlines = n_elements(data)/ds[dim]

dims = lindgen(ndim)+1
dims[dim-1] = -1
porder = sort(dims)

fdata = transpose(data,porder)
fdata = reform(fdata,ds[dim],nlines)

for i=0, nlines-1 do fdata[*,i] = fft(fdata[*,i],inverse=inverse)

dims[0] = dim
porder = sort(dims)
fdata = reform(fdata,(ds[1:ndim])[porder])
fdata = transpose(fdata,porder)

return, fdata
end


On Fri, 07 Dec 2001 19:05:36 GMT, hradilv.nospam@yahoo.com wrote:

> Here's what I came up with. Any comments?
>
> function ft1d, data, dim, inverse=inverse
>
> ds = size(data)
> ndim = ds[0]
> nlines = n_elements(data)/ds[dim]
>
> dims = lindgen(ndim)+1
> dims[dim-1] = -1
> porder = sort(dims)
>
> fdata = transpose(data,porder)
> fdata = reform(fdata,ds[dim],nlines)
>
> for i=0, nlines-1 do fdata[*,i] = fft(fdata[*,i],inverse=inverse)
>
> porder = (ds[1:ndim])[sort(dims)]
> fdata = reform(fdata,porder)
> fdata = transpose(fdata,sort(porder))
>
> return, fdata
> end
>
Re: FFT in 1 dimension [message #28500 is a reply to message #28498] Fri, 07 December 2001 11:05 Go to previous message
hradilv.nospam is currently offline  hradilv.nospam
Messages: 19
Registered: November 2001
Junior Member
Here's what I came up with. Any comments?

function ft1d, data, dim, inverse=inverse

ds = size(data)
ndim = ds[0]
nlines = n_elements(data)/ds[dim]

dims = lindgen(ndim)+1
dims[dim-1] = -1
porder = sort(dims)

fdata = transpose(data,porder)
fdata = reform(fdata,ds[dim],nlines)

for i=0, nlines-1 do fdata[*,i] = fft(fdata[*,i],inverse=inverse)

porder = (ds[1:ndim])[sort(dims)]
fdata = reform(fdata,porder)
fdata = transpose(fdata,sort(porder))

return, fdata
end
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: go button
Next Topic: fontpath in RH 7.2. PV-WAVE confused

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 09:01:30 PDT 2025

Total time taken to generate the page: 0.00403 seconds