Hacker News new | ask | show | jobs
by adamnemecek 2094 days ago
Julia interop with Python is insanely easy.

using PyCall

np = pyimport("numpy")

res = np.fft.fft(rand(ComplexF64, 10))

You just called numpy fft from Julia.

1 comments

Yes, and the interface is pretty fast and without any noticeable overhead:

julia> data = rand(ComplexF64, 1024^2);

# python fft from julia:

julia> res = @btime np.fft.fft(data);

  78.613 ms (39 allocations: 16.00 MiB)
# python fft in ipython:

In [11]: %timeit res = np.fft.fft(data)

89.3 ms ± 1.65 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)

As expected, julia has its own fft package (based on FFTW):

julia> res = @btime fft(data);

  61.540 ms (33 allocations: 16.00 MiB)