
On 12/9/11 11:25 AM, Ng, Enrico wrote:
I am trying to pass a multi-dimensional ndarray to C as a multi-dimensional C array for the purposes of passing it to mathematica. I am using PyArray_AsCArray but getting an error.
I understand that SWIG, Boost, et. al are perhaps too heavyweight for this one use, but you might want to give Cython a try. It makes it really easy to grab a numpy array (and tst it for compliance), and then you can do whatever you want with the data pointer: http://wiki.cython.org/tutorials/numpy http://wiki.cython.org/WrappingNumpy (this one is marked as depricated, but may be what you want in your case, as you do want a raw C array) Some wore googling and browsing of the Cython list will likely yield examples similar to yours. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker@noaa.gov