This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: ref


Gerard Jungman writes:
 > Varghese John wrote:
 > >
 > > Suppose that I am minimising a function and the
 > > minimum lies on one of the boundaries, the minimiser throws an "minimum 
 > > outside interval" error.
 > >
 > > Can you give me a simple example where I can trap that error
 > > (say x*x and interval [-1,0]).
 > > so that I can check status and proceed with out crashing.
 > 

You'll want to turn off the error handler at the start of the program
(or replace it with your own non-exiting error handler) and check the
return value from gsl_min_fminimizer_set().

    gsl_set_error_handler_off();
    ...

    status = gsl_min_fminimizer_set (f,....);

    if (status != GSL_SUCCESS) 
      {
        /* interval does not bound minimum reliably */
      }

regards
Brian Gough


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]