On 7/24/06, Ivan Liu <address@hidden> wrote:
> I'd like to ask some c++ experts about how to write the equivalent
> of type gsl_function using C++ convenctions, which takes
> arbitrary parameter list that can be defined localy.
In an object-oriented design, the API for the multi-dimensional root
finding and minimization packages is simplified somewhat. You don't
need to pass around an explicit void pointer for constant parameters,
since that role is taken over by the "this" pointer. Instead of
gsl_function, I would use an interface
interface Function
{
double f(double x);
}
in Java, or the equivalent abstract base class in C++. It is then up
any concrete implementation of Function to deal with additional
parameters.
Regards,
-- mj