[C++-sig] Accessing 2D array from python in C++

John Reid j.reid at mail.cryst.bbk.ac.uk
Wed Aug 22 13:11:00 CEST 2012



On 22/08/12 11:58, John Reid wrote:
> 
> 
> On 22/08/12 11:45, alfa wrote:
>> Hi John,
>>
>> I'm sorry, I'm a bit confused because previously you said that the
>> relevant implementation resides in
>> "c++/myrrh/myrrh/python/multi_array_to_numpy.h"but now, you point to
>> "src/python/man_module.cpp and src/python/multi_array_to_numpy.cpp".
>> Hope you understand my problem of having 2D array in python that needs
>> to be exposed/converted to C++. It would be great If I know any
>> method/function that I can invoke from any of your implementations.
>>
>> Thanks in advance.
> 
> Hi Alfa,
> 
> You can look at all of the code I've mentioned to work out how it works.
> If it does not make sense perhaps it might be worth working through the
> boost.python tutorial to get up to speed on how boost.python works.
> 
> You can call the expose_converters< npy_double >() function to expose
> multiarrays of doubles to python as numpy arrays.

Also look in python_test/test_man.py for code that tests the
implementation from the python side if it helps.



More information about the Cplusplus-sig mailing list