Re: GSL numeric overflow

Ralf Juengling <[email protected]> Wed, 14 Jan 2009 11:55:51 -0800 (PST)
Newsgroups gmane.lisp.lush.devel
Message-ID <[email protected]>
I have added a macro that helps with GSL error checking.
It is in packages/gsl/error-handling.lsh in the lush2.

Here is an example from libnum/linalgebra.lsh

(de solve-hh-inplace (a b)
   ((-idx2- (-double-)) a)
   ((-idx1- (-double-)) b)
   #{
   gsl_matrix ga;
   gsl_vector gb;
   IDX2GSL_MATRIX($a,ga,double);
   IDX2GSL_VECTOR($b,gb,double);
   #}
   (with-check-gsl-error #{ gsl_linalg_HH_svx(&ga,&gb) #})
   )

The macro temporarily turns of the GSL default error handler,
takes the return code from the GSL function and triggers a
Lush error when the code was not GSL_SUCCESS.

Ralf



On Sat, 18 Oct 2008, Scott Locklin wrote:

> Is there some plan for handling GSL problems in a more graceful way
> than killing the interpreter?
>
> Not presently a big issue, other than perhaps the least squares stuff
> I kicked over, but it seems like simple stuff like numeric overflow
> should get caught when you, say, (factorial 200)
>
> Looks pretty easy to point someplace useful with gsl_set_error_handler
>
> -Scott
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Lush-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/lush-devel
>

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword