Boost logo

Boost Users :

From: Sebastien Fortier (sebastien.fortier_at_[hidden])
Date: 2006-06-29 13:19:10


Thank you very much Daniel!

I had another question, is it possible to use multi_array and
const_multi_array_ref together in python.
What I mean is, if I create a multi_array from python through my c++
functions and I want to pass this array to another c++ function that
uses a const_multi_array_ref how do I manage this in the interface file?
is this possible?

I added class_<const_multi_array_ref<double, 2>
>("const_multi_array_2d_ref"); to my interface file but the types seem
to be incompatible.
I would prefer to use the const_multi_array_ref with the multi_arrays to
avoid copies...

I had to rewrite my functions to use only multi_array's to make the code
I had attached work.

Daniel Wallin wrote:

>Sebastien Fortier wrote:
>
>
>>I'm having some problems with the use of multi_array's with python. What
>>I'm trying to do is to export some functions that create multi_array's
>>and pass these multi_array's to other functions that will extract other
>>array's from them and display them.
>>
>>
>[...]
>
>
>>So you see I can't use my code, what am I doing wrong?
>>
>>
>
>You didn't export multi_array<double, 2> to Python. If you just want to
>pass the multi_array's around without manipulating them, it's enough to
>export it without any functions:
>
> class_<multi_array<double, 2> >("multi_array_2d");
>
>If you want a more complete binding, there's binding code for
>boost::multi_array queued for inclusion on the CVS. It's currently on a
>branch:
>
>Header:
> http://tinyurl.com/hm7pa
>
>Test:
> http://tinyurl.com/z7fzn
> http://tinyurl.com/hthg2
>
>HTH,
>
>

-- 
Sébastien Fortier


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net