On Mon, Dec 8, 2014 at 11:52 AM, serge Guelton <serge.guel...@enst-bretagne.fr> wrote: > Hi Cython dev, > > I am one of the two core developers of the Pythran[0] compiler. > We are planning to start a project where Cython would delegate the > generation of optimized (i.e. parallel / vectorized / without temporary > arrays) numpy expression when it finds one, instead of calling the > native API. Something like the following meaningless example: > > import numpy as np > cimport numpy as np > > def play_with_arrays(np.ndarray arr): > cdef int N = arr.shape[0] > cdef np.ndarray other_arr = np.empty([N], dtype=np.int) > > other_arr = arr ** 2 + 1 # pythran would handle this > > for i in range(N): > other_arr[i] /= 2 # cython would handle this > > return other_arr > > Everything would live in a pyx file and it should be transparent to a > cython user. Cython would drive the compilation process, using pythran > as a numpy expression optimizer. > > Does that look feasible / appealing to you? > > [0] http://pythonhosted.org/pythran/
Yes, that would be very cool; efficient array operations (including broadcasting) without intermediates is something we've long wanted to have. - Robert _______________________________________________ cython-devel mailing list cython-devel@python.org https://mail.python.org/mailman/listinfo/cython-devel