Re: [Numpy-discussion] sort bug

2007-04-26 Thread tan2
Just doing argsort() on the whole array is faster (up until about 1e6 elements) because it does everything in C whereas heapq will create a lot of Python objects because it is treating the array as a general Python container. That's a good point. I wasn't thinking about the efficiency issue. _

Re: [Numpy-discussion] sort bug

2007-04-26 Thread tan2
On 4/26/07, Anton Sherwood <[EMAIL PROTECTED]> wrote: > > > All I really need is the four highest eigenvalues and their vectors. > I'll have a look in "Python Cookbook" to see if there's a more > efficient way to do that partial sort. Maybe "heapq.nlargest()" is what you want? http://www.pyt

Re: [Numpy-discussion] New Operators in Python

2007-03-26 Thread tan2
On 3/26/07, René Bastian <[EMAIL PROTECTED]> wrote: May be it would be possible to implement a class with user "definissable" (?) signs. Yes, it is possible and is done. See this recipe to define an Infix operator class either: x |op| y or: x <> y http://aspn.activestate.com/ASPN/Cookbook/