28 Jun 2012 19:20
Re: Best Practices for passing numpy data pointer to C ?
Chris Barker <chris.barker <at> noaa.gov>
2012-06-28 17:20:45 GMT
2012-06-28 17:20:45 GMT
On Thu, Jun 28, 2012 at 3:05 AM, mark florisson > I think &input[0, 0] should still be preferred, as accessing the .data > attribute is deprecated in numpy and the rewrite to PyArray_DATA() not > yet merged. Taking the pointer to the first element is also more > consistent with memoryviews. Sounds compelling to me. I've put up a page on the Wiki: http://wiki.cython.org/tutorials/NumpyPointerToC and linked to it from: http://wiki.cython.org/tutorials/numpy I can't edit the main page, but maybe someone would like to put a link there, too. Or maybe it's time to collect links to all the numpy-specific pages in one place Please to go in a take a look and improve it if you like -- particular little C function -- I"m a pretty pathetic C coder -- it's not the point of the tutorial, but it doesn't follow best practices, it might be good to clean it up. -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
RSS Feed