[Numpy-discussion] numpy array to C API

Valentin Haenel valentin at haenel.co
Thu Mar 21 05:16:50 EDT 2013


Dear Daniele

* Daniele Nicolodi <daniele at grinta.net> [2013-03-21]:
> On 21/03/2013 09:45, Valentin Haenel wrote:
> > if you are new to interfacing python/numpy with C/C++, you may want to
> > check out:
> > 
> > http://scipy-lectures.github.com/advanced/interfacing_with_c/interfacing_with_c.html
> > 
> > Disclaimer: I am the author of this chapter, so this response is a bit
> > of a shameless plug :D
> 
> Hello Valentin,
> 
> I had a quick look at the chapter. It looks good! Thanks for sharing it.
> 
> However I have a small comment on the way you implement the Cython-Numpy
> solution. I would have written the loop over the array element in Cython
> itself rather than in a separately compiled C function. This would have
> the advantage of presenting more capabilities of Cython and would
> slightly decrease the complexity of the solution (one source file
> instead of two).

Thanks very much for your feedback! Since the chapter in under a CC
licence, you are welcome to submit your proposal as a Pull-Request. :D

The reason why I wrote  the loop in C is so that the cython example
synergieses with the others. The ideas is, that you have an already
existing code-base that has a function which has such a signature.
Ideally, your proposal would be an improvement, where the original
example stays in place and you develop the improvement including reasons
as to why it is better. ;)

best

V-



More information about the NumPy-Discussion mailing list