[Haskell-cafe] numeric minimization in Haskell

David Roundy droundy at darcs.net
Wed Feb 28 20:48:58 EST 2007


On Wed, Feb 28, 2007 at 02:54:06PM -0800, Dan Weston wrote:
> GSL is written in C, and I don't know any language more portable than 
> that! gsl_vector and gsl_matrix use a continuous block of doubles, so 
> you can use the FFI to marshall this however you want for efficiency.
> 
> I'd stick with GSLHaskell until you're ready to optimize the data 
> marshalling though.
> 
> I like spending my time on interesting things, not reinventing 
> pre-debugged and efficient libraries. I use GSLHaskell in my work and 
> have never had a problem.

It seems like GSLHaskell is an awfully big stick, when all you need are
scalar multiply and vector addition.  Of course, we don't know what
functions he wants to minimize, but in the absence of any need for GSL
functions, I don't see a good reason for it.

I see that GSLHaskell has a binding to a conjugate gradients minimizer, but
it's not useful for any hard problems (it stores the trajectory, which
defeats the purpose of using conjugate gradients), and can only be very,
very slow.

>From the API alone it cannot be efficient.  Code that is written by people
who obviously either don't know or don't care about efficiency is just not
in general a good idea.  I don't know what you use GSLHaskell for in your
work, but I hope you don't use it for conjugate gradients, or only use it
on easy problems.
-- 
David Roundy
Department of Physics
Oregon State University


More information about the Haskell-Cafe mailing list