On 10/8/06, Greg Willden <[EMAIL PROTECTED]> wrote: > On 10/8/06, Daniel Mahler <[EMAIL PROTECTED]> wrote: > > > > >>> a > > array([0, 0]) > > >>> b > > array([0, 1, 0, 1, 0]) > > >>> c > > array([1, 1, 1, 1, 1]) > > > > > Well for this particular example you could do > a=array([len(b)-sum(b), sum(b)]) > Since you are just counting the ones and zeros. > > This next one is a little closer for the case when c is not just a bunch of > 1's but you still have to know how the highest number in b. > a=array([sum(c[b==0]), sum(c[b==1]), ... sum(c[b==N]) ] ) > > So it sort of depends on your ultimate goal. > Greg > Linux. Because rebooting is for adding hardware.
In my case all a, b, c are large with b and c being orders of magnitude lareger than a. b is known to contain only, but potentially any, a-indexes, reapeated many times. c contains arbitray floats. essentially it is to compute class totals as in total[class[i]] += value[i] Daniel ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion