[Haskell-cafe] Re: ANNOUNCE: A Levenberg-Marquardt implementation

Roel van Dijk vandijk.roel at gmail.com
Fri Sep 11 03:33:54 EDT 2009

>> * http://hackage.haskell.org/package/bindings-levmar-0.1
> Which were the changes you needed to do to the library code? I
> believe this is going to cause you two problems: maintenance (as
> you can't always be sure the patched version didn't introduce a
> bug) and license (as levmar is GPL. You can't distribute it linked
> to non GPL code).
The C library prints error messages to stderr. We can check some
things before calling the C functions to ensure that some erroneous
conditions do not occur, but we can't prevent all cases. Since the
functions already returned a generic error code we disabled all
printing to stderr and created an enumeration of error codes. In
Haskell we wrap this error code in a nice data type so if something
goes wrong you'll know why. We have send a patch with these changes to
the author and we are waiting for a reply.

The license issue is indeed a problem. Either your (linked +
distributed) code must be GPL or you must acquire a different
(commercial) license from the author of the C library. The benefits of
the library we have chosen for this binding is that it is small, just
a few .c files, and it has almost no dependencies. If anyone knows of
any other implementations of Levenberg-Marquardt that are also easy to
bind then we would certainly like to hear it. If the feature set is
not to different we might be able to provide a common interface.

>> * http://hackage.haskell.org/package/levmar-0.1
> Cool.
> Don't you think the type level natural numbers deserve their own
> package?
Perhaps in the future. For this release we just focused on levmar. We
might also use another package for type level programming if it suits
our needs.

>> Unfortunately the documentation of these libraries is not
>> available from hackage because bindings-levmar won't configure
>> because of a missing dependency (lapack) on the hackage server.
> I'll try to write you a patch to solve that after I study better
> your code.
Lapack has to be installed on the hackage server in order for the
package to build. Another option is to temporarily remove the
dependency on lapack from the cabal file. The package would probably
build, you just wouldn't be able to link against it. But the downside
is that someone won't be able to cabal install it without first
modifying the .cabal file. That is unacceptable in my opinion.


More information about the Haskell-Cafe mailing list