Re: [Numpy-discussion] C++ class encapsulating ctypes-numpy array?

2008-03-24 Thread Stéfan van der Walt
Hi Joris Also take a look at the work done by Neal Becker, and posted on this list earlier this year or end of last. Please go ahead and create a cookbook entry on the wiki -- that way we have a central plce for writing up further explorations of this kind (also, let us know on the list if you

Re: [Numpy-discussion] C++ class encapsulating ctypes-numpy array?

2008-03-20 Thread Joris De Ridder
Thanks Matthieu, for the interesting pointer.My goal was to be able to use ctypes, though, to avoid having to do manual memory management. Meanwhile, I was able to code something in C++ that may be useful (see attachment). It (should) work as follows.1) On the Python side: convert a numpy array to

Re: [Numpy-discussion] C++ class encapsulating ctypes-numpy array?

2008-03-20 Thread Matthieu Brucher
2008/3/20, Joris De Ridder [EMAIL PROTECTED]: Thanks Matthieu, for the interesting pointer. My goal was to be able to use ctypes, though, to avoid having to do manual memory management. Meanwhile, I was able to code something in C++ that may be useful (see attachment). It (should) work as

Re: [Numpy-discussion] C++ class encapsulating ctypes-numpy array?

2008-03-20 Thread Matthieu Brucher
2008/3/20, Joris De Ridder [EMAIL PROTECTED]: You can use ctypes if and ony if the C++ object is only used in one function call. You can't for instance create a C++ container with ctypes, then in Python call some method and then delete the container, because ctypes will destroy the data

Re: [Numpy-discussion] C++ class encapsulating ctypes-numpy array?

2008-03-19 Thread Matthieu Brucher
Hi, On my blog, I spoke about the class we used. It is not derived from a Numpy array, it is implemented in terms of a Numpy array ( http://matt.eifelle.com/item/5) Matthieu 2008/3/19, Joris De Ridder [EMAIL PROTECTED]: Hi, I'm passing (possibly non-contiguous) numpy arrays (data + shape +