JohannesBuchner / cuba

Cuba - a library for multidimensional numerical integration
http://www.feynarts.de/cuba/
GNU Lesser General Public License v3.0
17 stars 6 forks source link

xgiven can't be used #6

Open mdarnold1 opened 3 years ago

mdarnold1 commented 3 years ago

xgiven for Divonne can't be used (at least in recent versions of python) because the copy to ctypes fails.

I believe the fix is to change line 277 of init.py to: xgiven = (c_double ngiven)(xgiven)

JohannesBuchner commented 3 years ago

Oh, great! Could you submit a pull request to the PyMultiNest repository?

mdarnold1 commented 3 years ago

Now that I look at this more carefully I can see that ngiven*ldxgiven values should be passed in, but the wrapper defines ngiven as len(xgiven) and the wrapper documentation describes xgiven as a list of points. I suppose that would imply each point in xgiven is itself an array, which I think is more complicated to flatten into a c array. Do you think it would be better to go with a flat list?

Either way when it is implemented the documentation should be clarified.

JohannesBuchner commented 3 years ago

The documentation is taken from cuba, so it should be followed. It seems a list of points is expected, so that should be what is passed. Probably it would make sense to allow passing numpy arrays or python lists, and the wrapper should convert them into 2d c arrays.