[Numpy-discussion] what is the best way to pass c, c++ array to numpy in cython?

Gael Varoquaux gael.varoquaux at normalesup.org
Wed Jan 4 01:28:45 EST 2012


On Tue, Jan 03, 2012 at 07:56:52PM -0800, Wonjun, Choi wrote:
> what is the best way to pass c, c++ array to numpy in cython?

I don't know if it is the best way, but I wrote a self-contained example
a little while ago, to explain to people one way of doing it:
http://gael-varoquaux.info/blog/?p=157

For multidimensional arrays, all you have to do is to pass in the full
shape and number of dimensions in the call to PyArray_SimpleNewFromData.

Hope this helps,

Gael



More information about the NumPy-Discussion mailing list