Re: [Numpy-discussion] fast method to to count a particular value in a large matrix

2012-02-06 Thread David Cournapeau
On Mon, Feb 6, 2012 at 1:17 AM, Wes McKinney wrote: > > Whenever I get motivated enough I'm going to make a pull request on > NumPy with something like khash.h and start fixing all the O(N log N) > algorithms floating around that ought to be O(N). NumPy should really > have a "match" function sim

Re: [Numpy-discussion] fast method to to count a particular value in a large matrix

2012-02-06 Thread Naresh
David: from 9-10 minutes to about 2-3 seconds, it's amazing! Thanks, Naresh ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] fast method to to count a particular value in a large matrix

2012-02-05 Thread Wes McKinney
On Sun, Feb 5, 2012 at 7:02 PM, David Verelst wrote: > Just out of curiosity, what speed-up factor did you achieve? > > Regards, > David > > On 04/02/12 22:20, Naresh wrote: >> Warren Weckesser  enthought.com>  writes: >> >>> >>> On Sat, Feb 4, 2012 at 2:35 PM, Benjamin Root  ou.edu>  wrote: >>> >

Re: [Numpy-discussion] fast method to to count a particular value in a large matrix

2012-02-05 Thread David Verelst
Just out of curiosity, what speed-up factor did you achieve? Regards, David On 04/02/12 22:20, Naresh wrote: > Warren Weckesser enthought.com> writes: > >> >> On Sat, Feb 4, 2012 at 2:35 PM, Benjamin Root ou.edu> wrote: >> >> >> On Saturday, February 4, 2012, Naresh Pai uark.edu> wrote:> I

Re: [Numpy-discussion] fast method to to count a particular value in a large matrix

2012-02-04 Thread Naresh
Warren Weckesser enthought.com> writes: > > > On Sat, Feb 4, 2012 at 2:35 PM, Benjamin Root ou.edu> wrote: > > > On Saturday, February 4, 2012, Naresh Pai uark.edu> wrote:> I am somewhat new to Python (been coding with Matlab mostly). I am trying to  > > > simplify (and expedite) a piece

Re: [Numpy-discussion] fast method to to count a particular value in a large matrix

2012-02-04 Thread Warren Weckesser
On Sat, Feb 4, 2012 at 2:35 PM, Benjamin Root wrote: > > > On Saturday, February 4, 2012, Naresh Pai wrote: > > I am somewhat new to Python (been coding with Matlab mostly). I am > trying to > > simplify (and expedite) a piece of code that is currently a bottleneck > in a larger > > code. > > I

Re: [Numpy-discussion] fast method to to count a particular value in a large matrix

2012-02-04 Thread Jerome Kieffer
On Sat, 4 Feb 2012 14:35:08 -0600 Benjamin Root wrote: > > no.unique() can return indices and reverse indices. It would be trivial to > histogram the reverse indices using np.histogram(). Even np.histogram(abc,unique_elem) or something like this. Works if unique_elem is ordered. np.histogram

Re: [Numpy-discussion] fast method to to count a particular value in a large matrix

2012-02-04 Thread Benjamin Root
On Saturday, February 4, 2012, Naresh Pai wrote: > I am somewhat new to Python (been coding with Matlab mostly). I am trying to > simplify (and expedite) a piece of code that is currently a bottleneck in a larger > code. > I have a large array (7000 rows x 4500 columns) titled say, abc, and I am t

[Numpy-discussion] fast method to to count a particular value in a large matrix

2012-02-04 Thread Naresh Pai
I am somewhat new to Python (been coding with Matlab mostly). I am trying to simplify (and expedite) a piece of code that is currently a bottleneck in a larger code. I have a large array (7000 rows x 4500 columns) titled say, abc, and I am trying to find a fast method to count the number of instan