"liam_herron" <li*********@hotmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
I have a core c++ library that is exposed to python through the
boost_python framework.
I would like to write the core of a Newton's method solver in C++ and
be able to write the
functions that are evaluated to be in python. Does anyone have any
ideas on this?
My suggestion would be to prototype in all-Python first. This will let you
work out the kinks of your call/callback interfaces. Then see if the
Newton's method part is a bottleneck worth converting to C++. My suspicion
is that the performance (for all but trivial functions) will be in the
function you are solving for, not in the Newton's metod. So be sure to test
with a function that you feel is representative of those you want to solve
for, not just a simple parabola.
Then, stop thinking in C++. "Function pointer"? A function in Python is
an object, a callable. You should be able to just treat it like one.
-- Paul