[SciPy-Dev] FFTLog

Dieter Werthmüller dieter at werthmuller.org
Sun Oct 9 13:13:12 EDT 2016


Joshua,

Thanks for the additional instructions for the fun :D

Cython is at the moment unfortunately slightly outside my knowledge 
zone. I will therefore wait a little while to see if I hear back from 
Takuya Ooura regarding license. If not I might give it a try, given I 
find the time to dive into Cython.

The actual fftlog.f-routine is not that long, and most if not all of the 
heavy lifting is done by rfft/irfft. Another approach might therefore be 
to rewrite fftlog.f into (c)python, instead of wrapping it. Just thinking.

I keep you informed on the status of cdgamma.f.

Dieter


On 08/10/16 15:04, Joshua Wilson wrote:
> Dieter,
>
> First, a warning: this is going to involve some fun. ;-) Before going
> too far you should probably check that the different versions of the
> complex Gamma functions use the same branch cuts, etc. Note that if you
> want this to work in your external git repo you'll need to build against
> scipy master.
>
> Steps should be roughly:
> -- Write a Cython script that wraps the Cython version of SciPy's
> loggamma. See
>
> https://scipy.github.io/devdocs/special.cython_special.html#module-scipy.special.cython_special
> <https://scipy.github.io/devdocs/special.cython_special.html#module-scipy.special.cython_special>
>
> for info on cimporting loggamma.
> -- Export the wrapper as a C function using these steps:
>
> http://docs.cython.org/en/latest/src/userguide/external_C_code.html#using-cython-declarations-from-c
> <http://docs.cython.org/en/latest/src/userguide/external_C_code.html#using-cython-declarations-from-c>
>
> -- Add the Cythonized C file to your setup and add an Interface block to
> your Fortran code letting it know how to call the C function.
>
> On Sat, Oct 8, 2016 at 1:11 PM, Dieter Werthmüller
> <dieter at werthmuller.org <mailto:dieter at werthmuller.org>> wrote:
>
>     Joshua
>
>     Thanks for your input. How could I include the Cython loggamma
>     function within my setup script, so that fftlog.f would pick it up?
>
>     Adjusting fftlog.f to pick up dfft*.f from
>     scipy/fftpack/src/dfftpack worked without problems. So if I could do
>     the same for loggamma, then the only new file would be fftlog.f, for
>     which we have the permission.
>
>     Thanks,
>     Dieter
>
>
>     On 07/10/16 21:18, Joshua Wilson wrote:
>
>         Re log gamma: under the hood the SciPy versions are in C (real
>         version)
>         and Cython (complex version), so linking them up with Fortran
>         code is
>         definitely doable.
>
>         On Fri, Oct 7, 2016 at 8:16 PM, Ralf Gommers
>         <ralf.gommers at gmail.com <mailto:ralf.gommers at gmail.com>
>         <mailto:ralf.gommers at gmail.com <mailto:ralf.gommers at gmail.com>>>
>         wrote:
>
>
>
>             On Sat, Oct 8, 2016 at 1:58 PM, Dieter Werthmüller
>             <dieter at werthmuller.org <mailto:dieter at werthmuller.org>
>         <mailto:dieter at werthmuller.org <mailto:dieter at werthmuller.org>>>
>         wrote:
>
>                 Evening,
>
>                 I wrote to Andrew Hamilton, and below is his answer. He has
>                 basically no problem with it at all, I just don't know
>         if his
>                 response is explicit enough.
>
>                 I think my email was quite extensive, and I assume that
>         is as
>                 much as we will get from him. I also do not expect him
>         to change
>                 his on "13 Mar 1999, 21:17" from TeX translated website...
>
>                 What do you think, is this enough?
>
>
>             Yes, that's perfectly fine. Thanks for clarifying that Dieter.
>
>             Cheers,
>             Ralf
>
>
>                 I also wrote to Takuya Ooura, and will let you know of his
>                 response, if I get one. However, as there are other complex
>                 logarithmic double precision gamma functions around, one
>         already
>                 in scipy, this piece is not mission critical.
>
>                 Regards,
>                 Dieter
>
>                 ========== START email correspondence with Andrew Hamilton
>                 ==========
>                 Subject: Re: FFTLog - license
>                 From: Andrew Hamilton <andrew.hamilton at colorado.edu
>         <mailto:andrew.hamilton at colorado.edu>
>                 <mailto:andrew.hamilton at colorado.edu
>         <mailto:andrew.hamilton at colorado.edu>>>
>                 Date: 07/10/16 18:22
>                 To: Dieter Werthmüller <dieter.werthmuller at gmx.ch
>         <mailto:dieter.werthmuller at gmx.ch>
>                 <mailto:dieter.werthmuller at gmx.ch
>         <mailto:dieter.werthmuller at gmx.ch>>>
>                 CC: Andrew.Hamilton at colorado.edu
>         <mailto:Andrew.Hamilton at colorado.edu>
>                 <mailto:Andrew.Hamilton at colorado.edu
>         <mailto:Andrew.Hamilton at colorado.edu>>
>
>
>                 Dieter,
>
>                 I approve your adding the license language you suggest to
>                 FFTLog, and making available the resulting package for
>         distribution.
>
>                 Andrew
>
>                 On 10/07/2016 03:42 PM, Dieter Werthmüller wrote:
>                 > Dear Andrew,
>                 >
>                 > Please apologize me bothering you again.
>                 >
>                 > After I published the code to wrap your FFTLog for
>         Python I
>                 thought that
>                 > it would be much better if your FFTLog would make it
>         straight
>                 into the
>                 > scientific library of Python. This would make your FFTLog
>                 available to a
>                 > much wider audience.
>                 >
>                 > I contacted the developers of SciPy
>         (http://scipy.org), and
>                 they are
>                 > interested in including your code. However, there is
>         one issue:
>                 > licensing. Code that is published on the web without a
>         license
>                 file is
>                 > copyrighted under law, and SciPy can for this reason not
>                 include your
>                 > code into their library.
>                 >
>                 > All I ask for is if you could confirm to us by email
>         that we
>                 are allowed
>                 > to distribute your FFTLog under the BSD-3-Clause license:
>                 > https://opensource.org/licenses/BSD-3-Clause
>         <https://opensource.org/licenses/BSD-3-Clause>
>                 <https://opensource.org/licenses/BSD-3-Clause
>         <https://opensource.org/licenses/BSD-3-Clause>>
>                 >
>                 > The license is just a suggestion, any other BSD or MIT
>         compatible
>                 > license would be fine as well. (For the same, legal
>         reasons we
>                 recommend
>                 > to publish a license file on your website too, but that is
>                 obviously
>                 > entirely up to you. It might, however, clarify things for
>                 future visitors.)
>                 >
>                 > It would only affect your fftlog.f file, and the
>         changes you
>                 made to
>                 > cdgamma.f. I will write Takuya OOURA as well regarding the
>                 original
>                 > cdgamma.f-file, asking him the same favour. And the three
>                 drfft*.f are
>                 > already in the SciPy-library with the whole FFTPack.
>                 >
>                 > If you are interested why this issue arises, Jake
>         Vanderplas,
>                 one of the
>                 > developers of SciPy, wrote an interesting article
>         about the topic:
>                 >
>
>         http://www.astrobetter.com/blog/2014/03/10/the-whys-and-hows-of-licensing-scientific-code/
>         <http://www.astrobetter.com/blog/2014/03/10/the-whys-and-hows-of-licensing-scientific-code/>
>
>         <http://www.astrobetter.com/blog/2014/03/10/the-whys-and-hows-of-licensing-scientific-code/
>         <http://www.astrobetter.com/blog/2014/03/10/the-whys-and-hows-of-licensing-scientific-code/>>
>                 >
>                 > Thank you again for your time and for making FFTLog
>         available!
>                 > Best regards,
>                 > Dieter
>                 >
>                 ========== END email correspondence with Andrew Hamilton
>         ==========
>
>                 On 07/10/16 15:13, Ralf Gommers wrote:
>
>
>
>                     On Sat, Oct 8, 2016 at 9:11 AM, Ralf Gommers
>                     <ralf.gommers at gmail.com
>         <mailto:ralf.gommers at gmail.com> <mailto:ralf.gommers at gmail.com
>         <mailto:ralf.gommers at gmail.com>>
>                     <mailto:ralf.gommers at gmail.com
>         <mailto:ralf.gommers at gmail.com>
>                     <mailto:ralf.gommers at gmail.com
>         <mailto:ralf.gommers at gmail.com>>>> wrote:
>
>
>
>                         On Sat, Oct 8, 2016 at 8:59 AM, Dieter Werthmüller
>                         <dieter at werthmuller.org
>         <mailto:dieter at werthmuller.org> <mailto:dieter at werthmuller.org
>         <mailto:dieter at werthmuller.org>>
>                     <mailto:dieter at werthmuller.org
>         <mailto:dieter at werthmuller.org>
>                     <mailto:dieter at werthmuller.org
>         <mailto:dieter at werthmuller.org>>>> wrote:
>
>                             Jake,
>
>                             Thanks for the clarification. I will try to
>         get the
>                     permissions
>                             from the
>                             authors.
>
>                             What is regarded as sufficient? Is an email
>         from the
>                     author,
>                             granting
>                             me/SciPy to distribute their code with a
>         specific,
>                     BSD-style license
>                             sufficient? Or do they necessarily have to
>         change
>                     the websites where
>                             they host the code to include the license?
>
>
>                         An email stating that the code can be
>         distributed under
>                     a BSD
>                         license  (or MIT or other compatible license) is
>         enough.
>
>
>                     Some delay on the line, missed Jake's answer. Email is
>                     enough, but a
>                     change in the repo would of course be even better.
>
>                     Ralf
>
>
>
>
>                     _______________________________________________
>                     SciPy-Dev mailing list
>                     SciPy-Dev at scipy.org <mailto:SciPy-Dev at scipy.org>
>         <mailto:SciPy-Dev at scipy.org <mailto:SciPy-Dev at scipy.org>>
>                     https://mail.scipy.org/mailman/listinfo/scipy-dev
>         <https://mail.scipy.org/mailman/listinfo/scipy-dev>
>                     <https://mail.scipy.org/mailman/listinfo/scipy-dev
>         <https://mail.scipy.org/mailman/listinfo/scipy-dev>>
>
>                 _______________________________________________
>                 SciPy-Dev mailing list
>                 SciPy-Dev at scipy.org <mailto:SciPy-Dev at scipy.org>
>         <mailto:SciPy-Dev at scipy.org <mailto:SciPy-Dev at scipy.org>>
>                 https://mail.scipy.org/mailman/listinfo/scipy-dev
>         <https://mail.scipy.org/mailman/listinfo/scipy-dev>
>                 <https://mail.scipy.org/mailman/listinfo/scipy-dev
>         <https://mail.scipy.org/mailman/listinfo/scipy-dev>>
>
>
>
>             _______________________________________________
>             SciPy-Dev mailing list
>             SciPy-Dev at scipy.org <mailto:SciPy-Dev at scipy.org>
>         <mailto:SciPy-Dev at scipy.org <mailto:SciPy-Dev at scipy.org>>
>             https://mail.scipy.org/mailman/listinfo/scipy-dev
>         <https://mail.scipy.org/mailman/listinfo/scipy-dev>
>             <https://mail.scipy.org/mailman/listinfo/scipy-dev
>         <https://mail.scipy.org/mailman/listinfo/scipy-dev>>
>
>
>
>
>         _______________________________________________
>         SciPy-Dev mailing list
>         SciPy-Dev at scipy.org <mailto:SciPy-Dev at scipy.org>
>         https://mail.scipy.org/mailman/listinfo/scipy-dev
>         <https://mail.scipy.org/mailman/listinfo/scipy-dev>
>
>     _______________________________________________
>     SciPy-Dev mailing list
>     SciPy-Dev at scipy.org <mailto:SciPy-Dev at scipy.org>
>     https://mail.scipy.org/mailman/listinfo/scipy-dev
>     <https://mail.scipy.org/mailman/listinfo/scipy-dev>
>
>
>
>
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at scipy.org
> https://mail.scipy.org/mailman/listinfo/scipy-dev
>



More information about the SciPy-Dev mailing list