In-place cumsum! etc. would also often make sense.
> On Jun 20, 2014, at 11:54 AM, Dahua Lin <linda...@gmail.com> wrote: > > The cumsum / cummax / cummin / cumprod, etc have suboptimal performance > currently, which are about 20x slower than the sum/prod etc (which we spent a > lot of efforts to optimize and tune). > > Please open an issue in Github, and we will try to address this problem later. > > Dahua > > >> On Friday, June 20, 2014 10:15:55 AM UTC-5, Charles Santana wrote: >> Dear Julia users, >> >> First of all, Congratulations for this amazing community and for this >> impressive language! I used to program in C++ and in R, I started to program >> with Julia 3 months ago and it has changed my life for better!! Thank you!! >> >> By checking the profile of a program we are developing we noted that the >> "bottleneck" seems to be in a cumulative sum along a dimension in a matrix, >> for what we use the function cumsum. >> >> We are doing something like this: >> >> DI = rand(5,5); >> Dc = cumsum(DI,2); >> >> Just to try to clarify what we are doing: Imagine that Matrix DI(i,j) >> represents the probability of an individual to move from a site i to a site >> j. We use Dc to determine to which site an individual in site i will move, >> by generating a random number between 0 and maximum(Dc[i,:]). That means, we >> are trying to perform a Multinomial Distribution. >> >> Do you know an alternative to cumsum or do you indicate a good way to use >> this function. >> >> Thanks in advance for any help! >> >> Best regards, >> >> Charles Novaes de Santana >> -- >> Um axé! :) >> >> -- >> Charles Novaes de Santana, PhD >> http://www.imedea.uib-csic.es/~charles