Conversation
There was a problem hiding this comment.
I did this in several places - hope you are fine with that.
I just discovered that the sqrt version is the fastest compared to the complex version and np.hypot.
In [5]: import numpy as np
In [6]: a = np.random.rand(int(1e6))
In [7]: b = np.random.rand(int(1e6))
In [10]: %timeit np.abs(a + 1j * b)
10 loops, best of 3: 40.4 ms per loop
In [11]: %timeit np.hypot(a, b)
10 loops, best of 3: 23.4 ms per loop
In [12]: %timeit np.sqrt(a ** 2 + b ** 2)
100 loops, best of 3: 8.13 ms per loopProbably I'll change it back, WDYT ?
There was a problem hiding this comment.
I changed it to np.hypot
|
I don't approve of the blanket use of whitespace around all binary operators. In many cases this renders the code less readable than before, and is contrary to PEP8, which says:
PEP8 encourages and discourages I'll indicate some of the changes that use excessive whitespace regardless of operator priority, contrary to PEP8. If we are going to use an automated tool to correct PEP8 compliance, it must be configured to be less aggressive than this. |
|
@ianthomas23 I absolutely agree (see PyCQA/pycodestyle#292 (comment)). |
Signed-off-by: Thomas Hisch <t.hisch@gmail.com>
|
@ianthomas23 I think it would be the best to ignore the space issues for the moment and fix them in a different PR |
|
I want to hold off on these until after 1.4. Touching this many files makes me nervous. |
|
I'll recreate a PR once 1.4 is released. |
examples/pylab_examples,examples/unitsandexamples/use_interfaceremain to be done.