<div dir="ltr"><div><div>Hi Nils,<br><br></div>I think performance will actually be better than I indicated, especially for larger arrays, since `r.real**2 + r.imag**2` makes a quite unnecessary intermediate arrays. With a `ufunc`, this can be done much faster. Indeed, it should be no slower than `np.square` (which does more operations):<br><br>%timeit b = np.square(a)<br>100000 loops, best of 3: 16.6 µs per loop<br><br></div><div>[This is on same laptop as the timings above.]<br></div><div><br></div>Chuck: agreed that a future np.abs2 could just reuse the internal ufunc loops for np.square except for the complex case.<div class="gmail_extra"><br></div></div>