help-gsl
[Top][All Lists]
Advanced

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

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


From: Eduardo Novaes Hering
Subject: [Help-gsl] Nonlinear Least Squares Fitting without analytic Jacobian.
Date: Fri, 4 Oct 2013 13:08:31 +0200

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!
  _   _   _   _   ___   _   _   _   _
_/ \_/ \_/ \_/ \_/   \_/ \_/ \_/ \_/ \_


Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail


reply via email to

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