Re: [Numpy-discussion] np.diag(np.dot(A, B))

2015-05-22 Thread Mathieu Blondel
wrote: > > > On Fri, May 22, 2015 at 5:39 PM, Mathieu Blondel > wrote: > >> Hi, >> >> I often need to compute the equivalent of >> >> np.diag(np.dot(A, B)). >> >> Computing np.dot(A, B) is highly inefficient if you only need the &

[Numpy-discussion] np.diag(np.dot(A, B))

2015-05-22 Thread Mathieu Blondel
Hi, I often need to compute the equivalent of np.diag(np.dot(A, B)). Computing np.dot(A, B) is highly inefficient if you only need the diagonal entries. Two more efficient ways of computing the same thing are np.sum(A * B.T, axis=1) and np.einsum("ij,ji->i", A, B). The first can allocate qui

Re: [Numpy-discussion] Objected-oriented SIMD API for Numpy

2009-10-22 Thread Mathieu Blondel
On Thu, Oct 22, 2009 at 5:05 PM, Sturla Molden wrote: > Mathieu Blondel skrev: > The PEP 3118 buffer syntax in Cython can be used to port NumPy to Py3k, > replacing the current C source. That might be what Norvig meant if he > suggested merging NumPy into Cython. As I wrote ear

Re: [Numpy-discussion] Objected-oriented SIMD API for Numpy

2009-10-21 Thread Mathieu Blondel
On Thu, Oct 22, 2009 at 11:31 AM, Sturla Molden wrote: > Mathieu Blondel skrev: >> Hello, >> >> About one year ago, a high-level, objected-oriented SIMD API was added >> to Mono. For example, there is a class Vector4f for vectors of 4 >> floats and this class

Re: [Numpy-discussion] Objected-oriented SIMD API for Numpy

2009-10-21 Thread Mathieu Blondel
On Wed, Oct 21, 2009 at 5:23 PM, David Cournapeau wrote: > Ah, I think you are mistaken, then - he referred to merging numpy and > scipy into python during his talk, not cython. Oh, I meant to say CPython (the default implementation of Python), not Cython. I didn't realize that they were differe

Re: [Numpy-discussion] Objected-oriented SIMD API for Numpy

2009-10-21 Thread Mathieu Blondel
On Wed, Oct 21, 2009 at 5:05 PM, David Cournapeau wrote: > Mathieu Blondel wrote: >> I saw the video of Peter Norvig at the last Scipy conference who was >> suggesting to merge Numpy into Cython. The SIMD API would be an >> argument in favor of this too because of the

Re: [Numpy-discussion] Objected-oriented SIMD API for Numpy

2009-10-21 Thread Mathieu Blondel
Hi David, On Wed, Oct 21, 2009 at 3:56 PM, David Cournapeau wrote: > I am not sure how this could be applied to numpy case ? From what I can > understand, this cannot be directly applied to python: the described > changes are vm changes, and we cannot do anything at python vm level (I > would gue

Re: [Numpy-discussion] Objected-oriented SIMD API for Numpy

2009-10-21 Thread Mathieu Blondel
> The licenses look all hodge-podge: [...] > However, if the good stuff is in the class libraries, that looks OK. But > that still leaves it in C#, no? I was mentioning Mono just to show that "this has been done" and also their API reference can serve as inspiration to design Numpy's own API.

[Numpy-discussion] Objected-oriented SIMD API for Numpy

2009-10-20 Thread Mathieu Blondel
Hello, About one year ago, a high-level, objected-oriented SIMD API was added to Mono. For example, there is a class Vector4f for vectors of 4 floats and this class implements methods such as basic operators, bitwise operators, comparison operators, min, max, sqrt, shuffle directly using SIMD oper