[Cython] aritmetic with arrays in Cython

Julian Taylor jtaylor.debian at googlemail.com
Tue Aug 5 21:38:38 CEST 2014


On 04.08.2014 21:11, Ian Henriksen wrote:
> Hi all,
> I noticed that some time ago there was a pull request
> (https://github.com/cython/cython/pull/144) open that was trying to
> implement basic arithmetic operations with arrays. This seems to have
> also been proposed in CEP 518
> (https://github.com/cython/cython/wiki/enhancements-simd). What is the
> status on this?
> 
> This is a feature I'd really like to see in Cython. I'd be happy to help
> with it, though I don't currently know enough about the internals of
> Cython to do it without some guidance. What would be the best way to do
> this? I've had three ideas thus far that might allow something like this
> to work, but I'd really like to get some second opinions before I get
> too far with any of them.
> 
> 1. Make these array operations available as a part of Cython's memory
> view objects.
> 
> 2. Write a Cython wrapper around a NumPy-like C++
> library. https://github.com/ContinuumIO/libdynd seems to be a good
> candidate, though I'm not as familiar with it. (This doesn't strike me
> as something that would be a part of the main Cython project, but it
> could be a good way to make this sort of functionality available. It
> seems like a good way to avoid a lot of duplicate work though.)
> 
> 3. Write a Fortran backend for Cython that uses Fortran's arrays
> wherever memory views are used.
> (This could be a bit crazy, but with the iso_c_binding module, it might
> be possible. It could also allow better optimizations for arrays to be
> applied by the compiler.)
> 
> What would be the best way to go about this?
> 

4. Use numpy itself. numpy since 1.8 has vectorized base math functions,
though for large arrays you have to apply manual blocking and inplace
operations to see significant gains. That is where cython can help.
Possibly numpy is also open to expose the raw data buffer functions in
its api to make blocking more efficient.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/cython-devel/attachments/20140805/6cf7f05d/attachment.sig>


More information about the cython-devel mailing list