[Numpy-discussion] EXTERNAL: Re: Problem with using PyArray_AsCArray
Ng, Enrico
enrico.ng at lmco.com
Fri Dec 9 16:20:43 EST 2011
I actually figured it out.
I went one level down in the array and it took it.
-----Original Message-----
From: numpy-discussion-bounces at scipy.org [mailto:numpy-discussion-bounces at scipy.org] On Behalf Of Chris.Barker
Sent: Friday, December 09, 2011 3:33 PM
To: Discussion of Numerical Python
Subject: EXTERNAL: Re: [Numpy-discussion] Problem with using PyArray_AsCArray
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 at noaa.gov
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion at scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion
More information about the NumPy-Discussion
mailing list