Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can the dependency of FFTW be replaced by AbstractFFTs? #50

Open
heliosdrm opened this issue Dec 16, 2024 · 12 comments
Open

Can the dependency of FFTW be replaced by AbstractFFTs? #50

heliosdrm opened this issue Dec 16, 2024 · 12 comments

Comments

@heliosdrm
Copy link

heliosdrm commented Dec 16, 2024

FFT.jl is a particular implementation of AbstractFFTs.jl, with a few exensions documented in https://juliamath.github.io/FFTW.jl/stable/fft/
But unless I have missed something, FourierTools does not use any of those functions.

So perhaps the dependency from FFTW might be dropped in favor of AbstractFFTs, and let users choose their preferred implementation (FFTW if they want, but also maybe FastTransforms, or RustFFT, for instance).

This might be arguably breaking, since users should install any of those implementations explicitly in order to use this package (in the fashion of FileIO), although nothing of their code would change. The advantages are that FourierTools would be lighter and more flexible.

@roflmaostc
Copy link
Member

Good remark.
What happens to all internal functions of FourierTools which call fft?

So to effectively use FourierTools, user always need to load a FFT backend. Right?

@RainerHeintzmann
Copy link
Member

Maybe one can ship it with "batteries", i.e. FFTW included but it then uses the FourierToolsCore package where it exports also almost all it's functions?
This was we can maintain compatibility.

@roflmaostc
Copy link
Member

Yeah we could but it would be some extra work.

So not sure if it's worth it.

Are the other mentioned packages in any way competitive with FFTW.jl already? So is it really of practical need?

@heliosdrm
Copy link
Author

heliosdrm commented Dec 17, 2024

FFTW.jl has the drawback of relying on a third party library with a GPL license, and in some specific situations might be a barrier to depend on it. FastTransforms is pure Julia, and RustFFT depends on a library licensed under Apache and MIT. RustFFT.jl also claims to be faster than FFTW.jl (see its README), although it is limited to one-dimensional variables.

@heliosdrm
Copy link
Author

So to effectively use FourierTools, user always need to load a FFT backend. Right?

Yes. e.g. using FourierTools (or using FourierToolsCore as per @RainerHeintzmann's suggestion) would not work alone. It should be using FourierToolsCore, FFTW or similar.

@roflmaostc
Copy link
Member

Yeah, or we would do two packages
FourierToolsCore
And
FourierTools

The latter would pull in FFTW.jl as default.

@heliosdrm
Copy link
Author

FastTransforms is pure Julia

Sorry, this statement was wrong: FastTransforms is a wrapper to a C library (MIT licensed).

@RainerHeintzmann
Copy link
Member

Are you sure that FFTW.jl is not free to use in Julia?
At least the package is MIT licenced.
https://github.com/JuliaMath/FFTW.jl/blob/master/LICENSE
That is not GPL.

@roflmaostc
Copy link
Member

Tdlr; The Julia code of FFTW.jl is MIT but not underlying FFTW code.

See https://github.com/JuliaMath/FFTW.jl?tab=readme-ov-file#license

@heliosdrm
Copy link
Author

I was going to prepare a PR to test how this proposed change would look like, and have realized that it is not totally straightforward, because there are a few functions (plan_conv plus others in czt.jl) that do depend on some constants defined in FFTW.

@RainerHeintzmann
Copy link
Member

... and possibly fftshift? Or is that part of the general framework?

@roflmaostc
Copy link
Member

This is covered by AbstractFFTs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants