[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-gsl] gsl_multifit_function_fdf callbacks in C++
From: |
eknecronzontas |
Subject: |
Re: [Help-gsl] gsl_multifit_function_fdf callbacks in C++ |
Date: |
Thu, 24 May 2007 05:16:49 -0700 (PDT) |
This won't work, as normal function pointers cannot hold pointers to member
functions. You'll have to either declare the member function as static, as you
suggest, or write a global function wrapper. I should point out also that, in
the example below, the function callback_df has to have the same argument list
as a gsl_multifit function (did you just omit the arguments for clarity?), and
that a multifit function may be different from a multimin function. Of course
you could also use my c++ library (wink wink -
http://tharkad.pa.msu.edu/~asteiner/hal/html/index.html)
Take care,
Andrew
----- Original Message ----
From: Pedro Figueiredo Santana <address@hidden>
To: address@hidden
Sent: Wednesday, May 23, 2007 7:19:54 PM
Subject: [Help-gsl] gsl_multifit_function_fdf callbacks in C++
Hi!
I'm using 'gsl_multifit_function_fdf' for a nonlinear minimisation
problem in C++. I would like to have the callback functions as members
of the class as shown below:
int MyClass::callback_df{
...
}
void MyClass::method1{
...
gsl_multifit_function_fdf f;
f.df = &MyClass::callback_df;
...
}
However, the g++ compiler says that it is not possible to convert the
method into the required callback type. Does anyone knows the best way
to do this? I've also tried to make the callback method static and
didn't help that much ...
Thanks,
Pedro Santana
_______________________________________________
Help-gsl mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/help-gsl