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: Ivan Liu
Subject: Re: [Help-gsl] gsl_function in c++
Date: Mon, 24 Jul 2006 15:28:06 +0200

Thanks Martin. But could you make it more explicit? How do you use
"this" pointer to pass the constant parameters?

Cheers,
Ivan


On 7/24/06, Martin Jansche <address@hidden> wrote:

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]