Re: [Cython] aritmetic with arrays in Cython

2014-08-07 Thread Matěj Laitl
On Monday 04 of August 2014 13:11:13 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.

Hi,
you may also check out https://github.com/strohel/Ceygen if it would suit your 
needs.

Cheers,
Matěj
___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] aritmetic with arrays in Cython

2014-08-07 Thread Ian Henriksen
Nice module! That seems to implement most of the basic functionality I've
seen lacking. Ideally, I'm still trying to find a way to be able to do
something syntactically like this:

cpdef whateverfunction(double[:] a, float[:] b):
return a + a * b + .5

It would be ideal if that sort of thing were already a part of Cython. All
things considered though, most of what I'm looking for seems to be there.

Thanks!

-Ian Henriksen


On Thu, Aug 7, 2014 at 1:58 AM, Matěj Laitl  wrote:

> On Monday 04 of August 2014 13:11:13 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.
>
> Hi,
> you may also check out https://github.com/strohel/Ceygen if it would suit
> your
> needs.
>
> Cheers,
> Matěj
>
___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] aritmetic with arrays in Cython

2014-08-07 Thread Stefan Behnel
Ian Henriksen schrieb am 08.08.2014 um 00:58:
> On Thu, Aug 7, 2014 at 1:58 AM, Matěj Laitl wrote:
>> you may also check out https://github.com/strohel/Ceygen if it would suit
>> your needs.

Interesting project. Thanks for sharing.


> Ideally, I'm still trying to find a way to be able to do
> something syntactically like this:
> 
> cpdef whateverfunction(double[:] a, float[:] b):
> return a + a * b + .5
> 
> It would be ideal if that sort of thing were already a part of Cython. All
> things considered though, most of what I'm looking for seems to be there.

Eigen can apparently do these things already:

http://eigen.tuxfamily.org/dox/TopicLazyEvaluation.html

It might not be all that much work to integrate this with Cython to enable
syntax support. Or have some kind of preprocessor, but I guess that's not
going to be simpler than have it in Cython as an optional AST transform.
Basically, whenever an arithmetic expression consists of a mixture of
memory views and (optionally) scalars, it could be mapped to the kind of
code that Ceygen uses, just at an arbitrarily complex expression length.

Specifically, this could be bound to the Matrix multiplication operator
(which Cython now supports anyway) and limited to C++ compilation mode
(which Eigen requires).

http://legacy.python.org/dev/peps/pep-0465/

Stefan

___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel