Package: fftlog
This is a simplef2py-wrapper for the logarithmic FFT codeFFTLogas
presented in Appendix B of[Hami00]and published atcasa.colorado.edu/~ajsh/FFTLog.A pure python version (pyfftlog) can be found ongithub.com/prisae/pyfftlog. Tests have shown thatfftlogis a bit
faster thanpyfftlog, butpyfftlogis easier to implement, as you only needNumPyandSciPy, without the need to compile anything.I hope thatFFTLogwill make it intoSciPyin the future, which will make
this project redundant. (If you have the bandwidth and are willing to chip in
have a look atSciPy PR #7310.)Be aware thatpyfftloghas not been tested extensively. It works fine for the
test from the original code, and my use case, which ispyfftlog.fftlwithmu=0.5(sine-transform),q=0(unbiased),k=1,kropt=1, andtdir=1(forward). Please let me know if you encounter any issues.Documentation:https://pyfftlog.readthedocs.ioSource Code:https://github.com/prisae/fftlogNotethat the documentation is for the pure python versionpyfftlog, but
equally applies tofftlog.Description of FFTLog from the FFTLog-WebsiteFFTLog is a set of fortran subroutines that compute the fast Fourier or Hankel
(= Fourier-Bessel) transform of a periodic sequence of logarithmically spaced
points.FFTLog can be regarded as a natural analogue to the standard Fast Fourier
Transform (FFT), in the sense that, just as the normal FFT gives the exact (to
machine precision) Fourier transform of a linearly spaced periodic sequence, so
also FFTLog gives the exact Fourier or Hankel transform, of arbitrary order m,
of a logarithmically spaced periodic sequence.FFTLog shares with the normal FFT the problems of ringing (response to sudden
steps) and aliasing (periodic folding of frequencies), but under appropriate
circumstances FFTLog may approximate the results of a continuous Fourier or
Hankel transform.The FFTLog algorithm was originally proposed by[Talm78].For the full documentation, seecasa.colorado.edu/~ajsh/FFTLog.InstallationYou can install fftlog either viaconda:conda install -c conda-forge fftlogor viapip:pip install fftlogCreationThe power off2pydid most of the work.Thesrc-directory contains the original fortran files as downloaded fromcasa.colorado.edu/~ajsh/FFTLog.  The
only change I made was to recode the coding offftlog.f, asf2pystruggled
with a few characters in the description part:recodelatin1..UTF-8fftlog.fThereafter I usedf2pyto produce thepyf-instructions with the following
command, generating only hooks for the functionsfhti,fttl,fht, andfhtq:f2pysrc/*-mfftlog-hfftlog.pyfonly:fhtifftlfhtfhtq:Lastly I amended thepyf-instructions, mainly with someintentandoptionalstatements as well as the corresponding default values.Noteskropt=3(interactive adjusting) is not possible withfftlogwsave-dimension is set to2*n+3*(n/2)+19, the biggest of the four
minimum sizes described infftlog.f.References[Hami00]Hamilton, A. J. S., 2000, Uncorrelated modes of the non-linear
power spectrum: Monthly Notices of the Royal Astronomical Society, 312,
pages 257-284; DOI:10.1046/j.1365-8711.2000.03071.x; Website of FFTLog:casa.colorado.edu/~ajsh/FFTLog.[Talm78]Talman, J. D., 1978, Numerical Fourier and Bessel transforms in
logarithmic variables: Journal of Computational Physics, 29, pages 35-48;
DOI:10.1016/0021-9991(78)90107-9.License, Citation, and CreditsThese additions to the original FFTLog-code are released to the public domain
under theCC0 1.0 License.All releases have a Zenodo-DOI, which can be found on10.5281/zenodo.3830364.Permission to distribute the original FortranFFTLogcode with this Pythonfftlogpackage has been granted (email from Andrew Hamilton to Dieter
Werthmüller dated 28 September 2016).Credits commented in the original code:FFTLoguses the NCAR suite of FFT routines, and a modified version of the
complex Gamma function from the gamerf package atmomonga.t.u-tokyo.ac.jp/~ooura/gamerf.html.
The original gamerf copyright statement states:Copyright(C) 1996 Takuya OOURA (email: ooura@mmm.t.u-tokyo.ac.jp).
You may use, copy, modify this code for any purpose and
without fee. You may distribute this ORIGINAL package.Permission to distribute the modified gamma function code with the FFTLog
package has been granted (email from Takuya Ooura to Andrew Hamilton dated 16
March 1999).Be kind and give credits by citing Hamilton (2000).