[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] error handling in gsl_root_fsolver_set()

From: Tommy Nordgren
Subject: Re: [Help-gsl] error handling in gsl_root_fsolver_set()
Date: Sat, 8 Dec 2007 13:29:07 +0100

On 7 dec 2007, at 00.19, jian Xu wrote:


I'm using gsl 1-D root finding algorithm, and I need to use
gsl_root_fsolver_set( ... ) to initilize the solver.  The problem is
whenever the root is NOT located inside the bounds, this function call
will immediately breaks the program.  And I cannot catch its error
even if I put this function in a try block:

       gsl_root_fsolver_set (s, &f, x_lo, x_hi);
       throw .......;   // Root is not bracked

Is there anyway to catch the error generated by gsl_root_fsolver_set()
?  Thanks a lot.


What you need to do first, is rebuild the GSL library in a way that allows exceptions to be thrown past c code. This require a certain option to be passed to gcc, which is not passed by default. Then you need to set up an error handler function that throws an exception, instead of exiting
"Home is not where you are born, but where your heart finds peace" -
Tommy Nordgren, "The dying old crone"

reply via email to

[Prev in Thread] Current Thread [Next in Thread]