[C++-sig] Accessing 2D array from python in C++
John Reid
j.reid at mail.cryst.bbk.ac.uk
Wed Aug 22 14:03:01 CEST 2012
On 22/08/12 12:28, alfa wrote:
> 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++.
Exposing works both ways.
>
> 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 wor k 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 <mailto:Cplusplus-sig at python.org>
> http://mail.python.org/mailman/listinfo/cplusplus-sig
>
>
>
>
> _______________________________________________
> Cplusplus-sig mailing list
> Cplusplus-sig at python.org
> http://mail.python.org/mailman/listinfo/cplusplus-sig
>
More information about the Cplusplus-sig
mailing list