Boost logo

Boost Users :

Subject: Re: [Boost-users] Invoking 'brent_find_minima' for a member function of a class?
From: s seelenluft (sseelenluft_at_[hidden])
Date: 2009-07-22 11:19:27


I had been advised elsewhere to look at memfun and bind1 (but not mem_fun or
better even boost::mem_fn or boost::bind). And finding examples was not that
simple, but the final solution is:

brent_find_minima(boost::bind(&Testclass::TrickyF, this, _1), min, max,
bits);

with 'Testclass' my class in which a function named 'TrickyF' is defined,
and min, max, bits further arguments for brent_find_minima.

On Mon, Jul 13, 2009 at 6:13 PM, s seelenluft <sseelenluft_at_[hidden]> wrote:

> Hi,
>
> I found this example:
> http://net.pku.edu.cn/~webg/src/paradise/thirdparty/installed/include/boost-1_35/boost/math/tools/minima.hpp>which works fine but I have trouble figuring out how to adapt this if the
> function to minimize is a member function of a class (and invoked in another
> member function).
> Any example of how to call brent_find_minima (or similar functions) from a
> member function and minimizing a member function would be very welcome. I
> have to the advice to wrap the function to be minimized into a static
> wrapper function but could not find an example how to do this from within a
> member function (I have it working when calling from main).
>
> Thanks.
>
> Markus
>
>
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net