Hi all: In the default interpolation interface to GSL, if one uses a set
of X values that are not monotonically increasing, GSL fails hard:
gsl: interp.c:83: ERROR: x values must be monotonically increasing
Default GSL error handler invoked.
this error cannot be caught by an exception handler, so is troublesome in
production code.
My collegue Jason Lin has found a simple patch which fixes this problem
(attached). This patch just turns off the default GSL error handler which
just calls 'stop'.
I've downloaded the latest GIT sources and applied it. It
seems to work. Any objections if I apply this patch? Here is a test case
for it:
--------------------------------------------------------------------------
my $nx = ($x)*($x<=3) + ($x-1)*($x>3); # x value not monotonically increasing
my $i; eval { $i = PDL::GSL::INTERP->init('cspline',$nx, $y) };
like($@,qr/invalid argument supplied by user/,"module exception handling");
--------------------------------------------------------------------------
I'm reluctant to add this to gsl_interp.t because it will cause the test
suite to fail hard if the patch has not been applied.
If there are no objections, I'll apply this patch in a couple of days.
Thanks,
Doug
[email protected]
Software Engineer
UCAR - COSMIC, Tel. (303) 497-2611
--- Lib/GSL/INTERP/gslerr.h.orig 2010-10-18 11:45:18.071924848 -0600
+++ Lib/GSL/INTERP/gslerr.h 2010-10-18 12:04:50.895265720 -0600
@@ -2,4 +2,7 @@
static int status;
static char buf[200];
-#define GSLERR(x,y) if (status = x y) {sprintf(buf,"Error in %s: %s",# x
,gsl_strerror(status));barf(buf);}
+/* Turn off GSL default handler. 10/18/2010 Jason Lin */
+#define GSLERR(x,y) \
+gsl_set_error_handler_off (); \
+if (status = x y) {sprintf(buf,"Error in %s: %s",# x
,gsl_strerror(status));barf(buf);}
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl