Re: [Numpy-discussion] Integers to integer powers, let's make a decision

2016-06-05 Thread Sturla Molden
Charles R Harris wrote: >1. Integers to negative integer powers raise an error. >2. Integers to integer powers always results in floats. 2 ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org https://mail.scipy.org/mailman/listinfo/num

Re: [Numpy-discussion] ENH: compute many inner products quickly

2016-06-05 Thread Charles R Harris
On Sun, Jun 5, 2016 at 6:41 PM, Stephan Hoyer wrote: > If possible, I'd love to add new functions for "generalized ufunc" linear > algebra, and then deprecate (or at least discourage) using the older > versions with inferior broadcasting rules. Adding a new keyword arg means > we'll be stuck with

Re: [Numpy-discussion] ENH: compute many inner products quickly

2016-06-05 Thread CJ Carey
A simple workaround gets the speed back: In [11]: %timeit (X.T * A.dot(X.T)).sum(axis=0) 1 loop, best of 3: 612 ms per loop In [12]: %timeit np.einsum('ij,ji->j', A.dot(X.T), X) 1 loop, best of 3: 414 ms per loop If working as advertised, the code in gh-5488 will convert the three-argument ein

Re: [Numpy-discussion] ENH: compute many inner products quickly

2016-06-05 Thread josef . pktd
On Sun, Jun 5, 2016 at 8:41 PM, Stephan Hoyer wrote: > If possible, I'd love to add new functions for "generalized ufunc" linear > algebra, and then deprecate (or at least discourage) using the older > versions with inferior broadcasting rules. Adding a new keyword arg means > we'll be stuck with

Re: [Numpy-discussion] ENH: compute many inner products quickly

2016-06-05 Thread Stephan Hoyer
On Sun, Jun 5, 2016 at 5:08 PM, Mark Daoust wrote: > Here's the einsum version: > > `es = np.einsum('Na,ab,Nb->N',X,A,X)` > > But that's running ~45x slower than your version. > > OT: anyone know why einsum is so bad for this one? > I think einsum can create some large intermediate arrays. It c

Re: [Numpy-discussion] ENH: compute many inner products quickly

2016-06-05 Thread Stephan Hoyer
If possible, I'd love to add new functions for "generalized ufunc" linear algebra, and then deprecate (or at least discourage) using the older versions with inferior broadcasting rules. Adding a new keyword arg means we'll be stuck with an awkward API for a long time to come. There are three types

Re: [Numpy-discussion] ENH: compute many inner products quickly

2016-06-05 Thread Mark Daoust
Here's the einsum version: `es = np.einsum('Na,ab,Nb->N',X,A,X)` But that's running ~45x slower than your version. OT: anyone know why einsum is so bad for this one? Mark Daoust On Sat, May 28, 2016 at 11:53 PM, Scott Sievert wrote: > I recently ran into an application where I had to comput

Re: [Numpy-discussion] Integers to integer powers, let's make a decision

2016-06-05 Thread Alan Isaac
On 6/4/2016 10:23 PM, Charles R Harris wrote: From my point of view, backwards compatibility is the main reason for choosing 1, otherwise I'd pick 2. If it weren't so easy to get floating point by using floating exponents I'd probably choose differently. As an interested user, I offer a summary