[Numpy-discussion] three-way comparisons

2016-05-14 Thread Phillip Feldman
I often find a need to do the type of comparison done by function shown below. I suspect that this would be more efficient for large arrays if implemented direction in C. Is there any possibility of adding something like this to NumPy? def three_way(x, y): """ This function performs a

Re: [Numpy-discussion] method to calculate the magnitude squared

2015-10-10 Thread Phillip Feldman
The ufunc approach makes sense. Something like abs2 is essential for anyone who does signal processing simulations using NumPy. Phillip On Sat, Oct 10, 2015 at 11:29 AM, Nathaniel Smith wrote: > On Oct 10, 2015 10:50 AM, "Charles R Harris" > wrote:

Re: [Numpy-discussion] method to calculate the magnitude squared

2015-10-09 Thread Phillip Feldman
extremely > difficult to do well, and may well be impossible to do perfectly. > > Good luck, > -n > On Oct 5, 2015 21:08, "Phillip Feldman" <phillip.m.feld...@gmail.com> > wrote: > >> My apologies for the slow response; I was experiencing some technical &g

Re: [Numpy-discussion] method to calculate the magnitude squared

2015-10-05 Thread Phillip Feldman
My apologies for the slow response; I was experiencing some technical problems with e-mail. In answer to Antoine's question, my main desire is for a numpy ndarray method, for the convenience, with a secondary goal being improved performance. I have added the function `magsq` to my library, but

[Numpy-discussion] method to calculate the magnitude squared

2015-09-18 Thread Phillip Feldman
In communications and signal processing, it is frequently necessary to calculate the power of a signal. This can be done with a function like the following: def magsq(z): """ Return the magnitude squared of the real- or complex-valued input. """ return z.real**2 + z.imag**2 A high

[Numpy-discussion] strange behavior of numpy.unique

2012-11-06 Thread Phillip Feldman
numpy.unique behaves as I would expect for small inputs like the following: In [12]: x= [0, 0, 1, 0, 1, 2, 0, 1, 2, 3] In [13]: unique(x, return_index=True) Out[13]: (array([0, 1, 2, 3]), array([0, 2, 5, 9], dtype=int64)) But, when I give it something larger, the return index values do not