[Numpy-discussion] Getting data from NDarrays to Blitz++ and back again

Philip Sterne pjs67@cam.ac...
Sat Apr 3 16:28:51 CDT 2010


Hi all,
I hope this is the correct place to post my question.  I'd like python 
to interface with c++ code that makes heavy use of Blitz++ arrays. 
After a day's hacking I appear to have a simple working solution which I 
am attaching.  (It uses Boost.Python and CMake.)

However I believe this solution won't work if the blitz array is not 
laid out contiguously in memory.  I also haven't really thought about 
reference counting issues (although the example seems to work).  I 
imagine that those sorts of issues will lead me to call the more 
complicated:
PyArray_New(...)
or:
PyArray_NewFromDescr(...)
instead of the PyArray_SimpleNewFromData(...) that I currently use. 
However I couldn't figure out some of the extra arguments from the API 
documentation.

Can someone point out all the things that will break when this code 
actually gets used in the real world (and maybe even how to avoid them)?

Thanks for your time!
	-Philip.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CMakeLists.txt
Url: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100403/c850c344/attachment.txt 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: simple.cpp
Type: text/x-c++src
Size: 1553 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100403/c850c344/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: simpletest.py
Type: text/x-python
Size: 136 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100403/c850c344/attachment.py 


More information about the NumPy-Discussion mailing list