Mon 22 Jun 2009 09:09:26 PM UTC, original submission:
Hi,
In fixing a bug with QtiPlot, I found myself in the need of asking gsl to abort the fitting process if an error occurred. Unfortunately, the error detection is not uniformly handled, and could be made to work satisfactorily in only one case, in the iterations of the Levenberg-Masquardt algorithm.
To be specific, the function set() in lmset.c does not check for error status in the evaluation of the points.
the line
GSL_MULTIFIT_FN_EVAL_F_DF (fdf, x, f, J);
should be
{
int status = GSL_MULTIFIT_FN_EVAL_F_DF (fdf, x_trial, J);
if (status)
return status;
}
as it's done correctly in the function iterate in lmiterate.c
as for the Nelder-Mead simplex, there's no way (that I could find ;) of passing an error status from the iterator to GSL. the function call is something like
val = GSL_MULTIMIN_FN_EVAL (f, x);
...
if (!gsl_finite(val))
... error ...
in both nmsimplex_iterate() and nmsimplex_set(), so the only way I figured to signalize an error is to pass an inf to val, so that the process will abort. Unfortunately, this crashes QtiPlot. There should be a way to pass a gsl status (in my case, GSL_ESING), as it's done in the Levenberg-Marquardt case.
Best regards,
Mateus
|