[Haskell-cafe] GSL special functions (Re: [Haskell] math library for Haskell)

Alberto Ruiz aruiz at um.es
Mon Jul 30 14:39:16 EDT 2007

(moved to Haskell-cafe)

On Wednesday 25 July 2007 12:52, Gregory Wright wrote:
> On Jul 25, 2007, at 6:39 AM, Chris Kuklewicz wrote:
> > Alberto Ruiz wrote:
> >> I have included a binding to gsl_sf_gamma in the darcs repo of
> >> GSLHaskell:
> >> http://dis.um.es/~alberto/GSLHaskell/doc/GSL-Special.html#v%3Agamma
> >> I will try to upload to hackage a recent version of the library in
> >> a few days.
> >> Alberto
> >
> > It occurs to me that generating the binding for all the GSL
> > "Special" functions by hand may be labor intensive.  Would it be
> > reasonable to have a (perhaps customized) tool generate the
> > wrapping code?

Absolutely! I am busy working on my applications and rewriting the internal 
support for the linear algebra wrappers, so I usually add new functions only 
when I need them for my own work. But a GSL library without the simplest 
functions is not very useful...

> I have some functions that make wrapping the GSL special functions
> much simpler.  I've used them
> to wrap all of the Airy and Bessel functions.  The process could be
> automated, but there are a few
> more cases than convenient.  (For example, the computationally
> expensive functions take an additional
> argument specifying how much precision is desired.)  It wouldn't be
> too much work to automate the
> most common cases (double arg, double return and double arg, error
> struct return); perhaps doing the
> remainder by hand is reasonable.

That's also right, so I have written a (very crude and ad-hoc) tool to  
generate wrappers for the most common cases. The results look promising:


They are available in the new version of the library. In principle it is 
already working but needs more testing. I plan to upload a version to hackage 
(the repo can be found in the GSLHaskell web page).

A problem with automatic wrappers is that we should still add a small piece of 
useful haddock documentation and appropriate tests for each function.

> I also have bindings for all of the ODE integration routines and all
> of the numerical differentiation
> routines.  All are low level, just exposing the underlying GSL
> routines without any "convenience wrapper".
> I can make them available if anyone is interested.
> Best Wishes,
> Greg

Good! I'd like to include a high level interface to the ODE routines. Perhaps 
it could be based on your bindings...

Best regards,

More information about the Haskell-Cafe mailing list