help-gsl
[Top][All Lists]
Advanced

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

Re: [Help-gsl] Nonlinear Least Squares Fitting without analytic Jacobian


From: Patrick Alken
Subject: Re: [Help-gsl] Nonlinear Least Squares Fitting without analytic Jacobian.
Date: Fri, 04 Oct 2013 07:39:01 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130330 Thunderbird/17.0.5

This feature was added in v1.16, can you make sure you're running that version?

On 10/04/2013 05:08 AM, Eduardo Novaes Hering wrote:
Good morning!

I hope I'm not asking a too stupid question.

I'm trying to use the GSL Nonlinear Least Squares Fitting
without an analytic Jacobian. From the GSL manual, I quote:

int (* df) (const gsl_vector * x, void * params, gsl_matrix * J)
this function should store the n-by-p matrix result J_ij = d f_i(x,params) / d 
x_j in J for argument x and arbitrary parameters params, returning an 
appropriate error code if the function cannot be computed. If an analytic 
Jacobian is unavailable, or too expensive to compute, this function pointer may 
be set to NULL, in which case the Jacobian will be internally computed using 
finite difference approximations of the function f.

int (* fdf) (const gsl_vector * x, void * params, gsl_vector * f, gsl_matrix * 
J)
This function should set the values of the f and J as above, for arguments x 
and arbitrary parameters params. This function provides an optimization of the 
separate functions for f(x) and J(x)—it is always faster to compute the 
function and its derivative at the same time. If an analytic Jacobian is 
unavailable, or too expensive to compute, this function pointer may be set to 
NULL, in which case the Jacobian will be internally computed using finite 
difference approximations of the function f.

So I tried the following section of code:

   f.f = &F;
   f.df = NULL; //&DF
   f.fdf = NULL; //&FDF

and got this result:

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000

when this function is called:

   gsl_multifit_fdfsolver_set (s, &f, &x.vector);

I can send the complete code attached to elucidate the question,
but I advance that the fitting worked when I gave it the analytic
Jacobian. But now I want to fit arbitrary functions and an analytic
Jacobian is not an option.

Thanks for your attention,

Eduardo.

Eduardo Novaes Hering, PhD (MSc, DSc).
______________________________________
address@hidden
address@hidden
address@hidden
_______________________________________

INAC/SPSMS/IMAPEC, CEA Grenoble.
17 rue des Martyrs, 38054
Grenoble cedex 9. France.
_______________________________________

Work:   (+33)or(0) 4 58 78 35 03
Mobile: (+33)or(0) 6 59 70 60 12
Fax :   (+33)or(0) 4 38 78 50 96
Home:   (+33)or(0) 9 66 84 10 40
Skype: enhering
Twitter: @enhering
http://www.gabuleu.com/enhering
_______________________________________

         Stop buying from China
          until Tibet is free!
   _   _   _   _   ___   _   _   _   _
_/ \_/ \_/ \_/ \_/   \_/ \_/ \_/ \_/ \_






reply via email to

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