Re: [Numpy-discussion] From Python to Numpy

2017-01-13 Thread Matthew Harrigan
I coded up an all_equal gufunc here . Benchmark results are also in that repo. For the specific problem in the book which started this, its 40x faster than the optimized code in the book. For large arrays which have any early non equal eleme

Re: [Numpy-discussion] From Python to Numpy

2017-01-10 Thread Chris Barker - NOAA Federal
> It seems a generalized ufunc "all_equal" with signature (i),(i)->() and short > circuit logic once the first non equal element is encountered would be an > important performance improvement. How does array_equal() perform? -CHB ___ NumPy-Discussion

Re: [Numpy-discussion] From Python to Numpy

2017-01-09 Thread Matthew Harrigan
I also have been stalking this email thread. First, excellent book! Regarding the vectorization example mentioned above, one thing to note is that it increases the order of the algorithm relative to the pure python. The vectorized approach uses correlate, which requires ~(len(seq) * len(sub)) FLO

Re: [Numpy-discussion] From Python to Numpy

2017-01-05 Thread Alex Rogozhnikov
> 31 дек. 2016 г., в 2:09, Nicolas P. Rougier > написал(а): > >> >> On 30 Dec 2016, at 20:36, Alex Rogozhnikov >> wrote: >> >> Hi Nicolas, >> that's a very nice work! >> >>> Comments/questions/fixes/ideas are of course welcome. >> >> Boids example brought my attention too, some comments

Re: [Numpy-discussion] From Python to Numpy

2016-12-31 Thread Nicolas P. Rougier
> I’ve seen vectorisation taken to the extreme, with negative consequences in > terms of both speed and readability, in both Python and MATLAB codebases, so > I would suggest some discussion / wisdom about when not to vectorise. I agree and there is actually a warning in the introduction abou

Re: [Numpy-discussion] From Python to Numpy

2016-12-30 Thread Marmaduke Woodman
> On 22 Dec 2016, at 17:44, Nicolas P. Rougier wrote: > > > Dear all, > > I've just put online a (kind of) book on Numpy and more specifically about > vectorization methods. It's not yet finished, has not been reviewed and it's > a bit rough around the edges. But I think there are some mater

Re: [Numpy-discussion] From Python to Numpy

2016-12-30 Thread Nicolas P. Rougier
> On 30 Dec 2016, at 20:36, Alex Rogozhnikov wrote: > > Hi Nicolas, > that's a very nice work! > >> Comments/questions/fixes/ideas are of course welcome. > > Boids example brought my attention too, some comments on it: > - I find using complex numbers here very natural, this should speed up t

Re: [Numpy-discussion] From Python to Numpy

2016-12-30 Thread Alex Rogozhnikov
Hi Nicolas, that's a very nice work! > Comments/questions/fixes/ideas are of course welcome. Boids example brought my attention too, some comments on it: - I find using complex numbers here very natural, this should speed up things and also shorten the code (rotating without einsum, etc.) - you

Re: [Numpy-discussion] From Python to Numpy

2016-12-23 Thread Kiko
2016-12-22 17:44 GMT+01:00 Nicolas P. Rougier : > > Dear all, > > I've just put online a (kind of) book on Numpy and more specifically about > vectorization methods. It's not yet finished, has not been reviewed and > it's a bit rough around the edges. But I think there are some material that > can

Re: [Numpy-discussion] From Python to Numpy

2016-12-22 Thread Chris Barker
Nicolas, >From a quick glance, this looks really wonderful! I intend to point my students that are interested in numpy to it. -CHB On Thu, Dec 22, 2016 at 8:44 AM, Nicolas P. Rougier < nicolas.roug...@inria.fr> wrote: > > Dear all, > > I've just put online a (kind of) book on Numpy and more sp

[Numpy-discussion] From Python to Numpy

2016-12-22 Thread Nicolas P. Rougier
Dear all, I've just put online a (kind of) book on Numpy and more specifically about vectorization methods. It's not yet finished, has not been reviewed and it's a bit rough around the edges. But I think there are some material that can be interesting. I'm specifically happy with the boids exa