Saturday, June 13, 2009

GSL: GNU Scientific Library

I was looking into the GSL for a project. I am puzzled about the design of the LU solver. To solve a system of linear equations Ax=b, one would call gsl_linalg_LU_decomp followed by gsl_linalg_LU_solve. The strange thing is: non of these functions has a return code for “sorry: the matrix was singular”. When passing a singular matrix both routines will return GSL_SUCCESS.

I thought it would be a good idea to give the GSL people some feedback on this: http://lists.gnu.org/archive/html/bug-gsl/2009-06/msg00005.html.

Looking at the linear algebra code, I have to say the implementation looks rather unsophisticated compared to say LINPACK or LAPACK.

Update: the GSL people answered here. Better than nothing, but not optimal. You really want this flag in the decomposition as it is detected there, and because it makes it easier to write:

call decomp(A);
if not singular then
   for i := 1 to NumRHS do
      call solve(rhs[i]);

Never thought I would say this, but it looks like LINPACK/LAPACK is more user-friendly than GSL in this respect.

4 comments:

  1. Have you taken a look at drools-solver?
    https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-solver/html_single/index.html

    The drools-solver examples include the traveling tournament problem, ITC2007 examination and ITC curriculum course.
    Have you tried any solvers on problems of those sizes or larger? What where the results given the limited time?

    ReplyDelete
  2. That does not look very relevant to solving systems of linear equations, or am I missing something?

    ReplyDelete
  3. As I understand it (I could be wrong), equations are used to solve planning problems.
    The constraints of a planning problem are written as equations and the optimal values for the variables are calculated.

    But indeed, if you're not tackling a planning problem with your equation, drools-solver is irrelevant. I got linked to this blog from a planning problem blog and I am trying to harvest positive criticism (or even patches) of other experts on my planning problem framework.

    ReplyDelete
  4. Your product is certainly interesting. This specific post was about LU decomposition for solving a system of linear equations. This is a very fast method, while simulated annealing, tabu search etc. is typically applied when no fast methods are known. Btw. your description of the simplex method does not make much sense to me.

    ReplyDelete