help-gsl
[Top][All Lists]
Advanced

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

Re: [Help-gsl] gsl_function in c++


From: Martin Jansche
Subject: Re: [Help-gsl] gsl_function in c++
Date: Mon, 24 Jul 2006 08:50:31 -0400

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




reply via email to

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