Re:Re: Counting list elements above/below a given value
- To: mathgroup at smc.vnet.net
- Subject: [mg17392] Re:[mg17328] Re: [mg17202] Counting list elements above/below a given value
- From: "Tomas Garza" <tgarza at mail.internet.com.mx>
- Date: Thu, 6 May 1999 02:44:11 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Paul Abbott wrote:
> Tomas Garza wrote:
>
> > Third, either you have a very slow machine or you are exceedingly greedy
> > with your computer time. As an example, I use a 1000 x 1000
> matrix, which is
> > far greater than the one you have in your problem, and obtain
> the following
> > results (suppose value = 500):
> >
> > In[1]:=
> > listA=Table[{Random[Integer,{1,1000}],Random[Integer,{1,1000}]},{1000}];
>
> But this is only a list of size 1000x2? I think Mathematica will be
> rather slower when operating on a 1000x1000 matrix ...
>
> Cheers,
> Paul
Paul,
Absolutely right and very foolish of me. Still,
In[4}:=
data= Table[Random[],{1000},{1000}];
In[5]:=
Count[data, x_/;x>.5,{2}]//Timing
Out[5]=
{35.59 Second,499933}
35.59 seconds is far, far greater then the 0.06 seconds I mistakenly offered
for the original problem, but is still a reasonable time, unless of course
one has to perform the same calculation over and over again. My apologies...
Tomas Garza
Mexico City