Skip to content

Expose c++ integrator to python #288

@rmjarvis

Description

@rmjarvis

In the Cosmology class, we currently use scipy to do the requisite integration for the Da calculation. Since we have an integrator in c++, it would be nice if we could just use that from python and remove our scipy dependency.

I think this should be relatively easy now that I found this StackOverflow post:

http://stackoverflow.com/questions/8200414/python-function-as-parameter-to-c-exposed-class-using-boostpython

(From what they wrote there, I think I know how to do it without using the c++11 lambda feature.)

What I'm planning to do is to write a c++ function that takes in a python function (via boost::python::object) and the bounds of the integration and perform the integral. I can then wrap this function so it's callable from python. This will require having a c++ function object that the integrator can use, which just wraps the python object and farms out the function calls to it.

@TallJimbo Jim, do you see any stumbling blocks with this approach before I dive in?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions