David Huard wrote: > 2006/10/24, Vincent Schut <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>>: > > It is clear to me that the numpy += operator in combination with > the use > of arrays of indexes, as is explained in the Tentative Numpy Tutorial > ( > > http://www.scipy.org/Tentative_NumPy_Tutorial#head-3f4d28139e045a442f78c5218c379af64c2c8c9e), > the limitation being that indexes that appear more than 1 time in the > indexes-array will get incremented only once. > > Does anybody know a way to work around this? > > > I am using this to fill up a custom nd-histogram, and obviously > each bin > should be able to get incremented more than once. Looping over the > entire array and incrementing each bin succesively takes waaay to long > (these are pretty large arrays, like 4000x2000 items, or even larger) > > > I don't know the answer to the first question, but I'd like to ask if > you tried histogramdd ? If its lacking some features, i'd be willing > to implement them. > > David No, haven't tried that, but actually my nd-histogram is a bit special. Firstly, it is not a histogram in the usual sample counting sense, but I need it to give me the average of values that are inserted in a certain bin (so actually I'm summing and counting, and finally divide the sums by the counts). Then, the bin number a sample goes into is not determined by the position of the sample in the array, but by the value of cells with the same position in other arrays. Lastly, not only these arrays are large, but there are many, and I need the final average, so I need to be able to update my histogram many times in a row. I think these needs are a bit too peculiar to have them added to histogramdd. I have already got my own nd-averagingHistogram class which does exactly what I want, only point it that it is slow because of the loop. So that's why I asked here if anyone knows a workaround.
Vincent. > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > ------------------------------------------------------------------------ > > _______________________________________________ > Numpy-discussion mailing list > Numpy-discussion@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/numpy-discussion > ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion