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

alfa alfarobi0161 at yahoo.com
Wed Aug 22 13:28:18 CEST 2012


Hi John,

"You can call the expose_converters< npy_double >() function to expose multiarrays of doubles to python as numpy arrays."

I'm afraid you understood that I have a C++ array that is to be exposed in Python. Actually, my problem is the other way around in which I have a Python array that needs to be converted to/ exposed in C++.

Thanks in advance.




________________________________
 From: John Reid <j.reid at mail.cryst.bbk.ac.uk>
To: cplusplus-sig at python.org 
Sent: Wednesday, August 22, 2012 1:11 PM
Subject: Re: [C++-sig] Accessing 2D array from python in C++
 


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.

_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig at python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20120822/7dea11b7/attachment.html>


More information about the Cplusplus-sig mailing list