Skip to content

Commit

Permalink
Working fft. Addresses issue #60.
Browse files Browse the repository at this point in the history
  • Loading branch information
ViralBShah committed Jun 22, 2011
1 parent 52df227 commit 3697dae
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions j/fft.j
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
fftw = dlopen("libfftw3")

FFTW_FORWARD = int32(-1)
FFTW_ESTIMATE = uint32(64)

function fft(X::Vector{Complex128})

Y = copy(X)

plan = ccall(dlsym(fftw, "fftw_plan_dft_1d"),
Ptr{Void},
(Int32, Ptr{Complex128}, Ptr{Complex128}, Int32, Uint32, ),
length(X), X, Y, FFTW_FORWARD, FFTW_ESTIMATE)

ccall(dlsym(fftw, "fftw_execute"),
Void,
(Ptr{Void},),
plan)

return Y

end

0 comments on commit 3697dae

Please sign in to comment.