[Numpy-discussion] From Python to Numpy

Alex Rogozhnikov alex.rogozhnikov at yandex.ru
Thu Jan 5 04:12:24 EST 2017


> 31 дек. 2016 г., в 2:09, Nicolas P. Rougier <Nicolas.Rougier at inria.fr> написал(а):
> 
>> 
>> On 30 Dec 2016, at 20:36, Alex Rogozhnikov <alex.rogozhnikov at yandex.ru> 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 things and also shorten the code (rotating without einsum, etc.)
>> - you probably can speed up things with going to sparse arrays 
>> - and you can go to really large numbers of 'birds' if you combine it with preliminary splitting of space into squares, thus analyze only birds from close squares
>> 
>> Also I think worth adding some operations with HSV / HSL color spaces as those can be visualized easily e.g. on some photo.
>> 
>> Thanks,
>> Alex.
> 
> 
> Thanks.
> 
> I'm not sure to know how to use complex with this example. Could you elaborate ?

Position and velocity are encoded by complex numbers.
Rotation is multiplication by exp(i \phi), translating is adding a complex number.
Distance = abs(x - y). 

I think, that's all operations you need, but maybe I miss something.

> 
> For the preliminary splitting, a quadtree (scipy KDTree) could also help a lot but I wanted to stick to numpy only.
> A simpler square splitting as you suggest could make thing faster but require some work. I'm not sure yet I see how to restrict analysis to close squares.
> 
> Nicolas
> 
> 
>> 
>> 
>> 
>>> 23 дек. 2016 г., в 12:14, Kiko <kikocorreoso at gmail.com> написал(а):
>>> 
>>> 
>>> 
>>> 2016-12-22 17:44 GMT+01:00 Nicolas P. Rougier <Nicolas.Rougier at inria.fr>:
>>> 
>>> 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 example that show a nice combination of numpy and matplotlib strengths.
>>> 
>>> Book is online at: http://www.labri.fr/perso/nrougier/from-python-to-numpy/
>>> Sources are available at: https://github.com/rougier/from-python-to-numpy
>>> 
>>> 
>>> Comments/questions/fixes/ideas are of course welcome.
>>> 
>>> Wow!!! Beautiful.
>>> 
>>> Thanks for sharing.
>>> 
>>> 
>>> 
>>> Nicolas
>>> _______________________________________________
>>> NumPy-Discussion mailing list
>>> NumPy-Discussion at scipy.org
>>> https://mail.scipy.org/mailman/listinfo/numpy-discussion
>>> 
>>> _______________________________________________
>>> NumPy-Discussion mailing list
>>> NumPy-Discussion at scipy.org
>>> https://mail.scipy.org/mailman/listinfo/numpy-discussion
>> 
>> _______________________________________________
>> NumPy-Discussion mailing list
>> NumPy-Discussion at scipy.org
>> https://mail.scipy.org/mailman/listinfo/numpy-discussion
> 
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org <mailto:NumPy-Discussion at scipy.org>
> https://mail.scipy.org/mailman/listinfo/numpy-discussion <https://mail.scipy.org/mailman/listinfo/numpy-discussion>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20170105/ea235e0a/attachment.html>


More information about the NumPy-Discussion mailing list