[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 3-wa

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: > > > > On Sat, Oct 10, 2015 at 11:14 AM, Ma

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

2015-10-09 Thread Phillip Feldman
tremely > difficult to do well, and may well be impossible to do perfectly. > > Good luck, > -n > On Oct 5, 2015 21:08, "Phillip Feldman" > wrote: > >> My apologies for the slow response; I was experiencing some technical >> problems with e-mail. >&

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 wo

[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 pe

[Numpy-discussion] numpy.nanmin, numpy.nanmax, and scipy.stats.nanmean

2013-05-16 Thread Phillip Feldman
It seems odd that `nanmin` and `nanmax` are in NumPy, while `nanmean` is in SciPy.stats. I'd like to propose that a `nanmean` function be added to NumPy. Phillip ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/

[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 alway