[pythran] Re: dimension-independent functions?

  • From: Mehdi Amini <joker.eph@xxxxxxxxx>
  • To: pythran@xxxxxxxxxxxxx
  • Date: Fri, 05 Sep 2014 08:54:31 -0700

def sqrv(x):
        return x * x

I didn't know pythran would produce an element-wise iteration over the whole
array from this code.
That's valid numpy, nothing specific to Pythran.

You could add that the difference with Numpy comes when you have an expression like x * x * x. Numpy would create a temporary array, compute the first operation using this temporary, and then doing a second scan to compute the second operation.
Pythran would do only *one* iteration over the array.


Other related posts: