Re: [R] fast rowCumsums wanted for calculating the cdf

2010-10-15 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Joshua Wiley > Sent: Friday, October 15, 2010 12:23 AM > To: Gregor > Cc: r-help@r-project.org > Subject: Re: [R] fast rowCumsums wanted for calculating the

Re: [R] fast rowCumsums wanted for calculating the cdf

2010-10-15 Thread Douglas Bates
Although I know there is another message in this thread I am replying to this message to be able to include the whole discussion to this point. Gregor mentioned the possibility of extending the compiled code for cumsum so that it would handle the matrix case. The work by Dirk Eddelbuettel and Rom

Re: [R] fast rowCumsums wanted for calculating the cdf

2010-10-15 Thread Joshua Wiley
On Fri, Oct 15, 2010 at 12:23 AM, Joshua Wiley wrote: > > Hi, > > You might look at Reduce().  It seems faster.  I converted the matrix > to a list in an incredibly sloppy way (which you should not emulate) > because I cannot think of  the simple way. Dennis provided the answer: system.time(add(

Re: [R] fast rowCumsums wanted for calculating the cdf

2010-10-15 Thread Joshua Wiley
Hi, You might look at Reduce(). It seems faster. I converted the matrix to a list in an incredibly sloppy way (which you should not emulate) because I cannot think of the simple way. > probs <- t(matrix(rep(1:1000), nrow=10)) # matrix with row-wise > probabilites > F <- matrix(0, nrow=nro

Re: [R] fast rowCumsums wanted for calculating the cdf

2010-10-14 Thread Gregor
Dear all, Maybe the "easiest" solution: Is there anything that speaks against generalizing cumsum from base to cope with matrices (as is done in matlab)? E.g.: "cumsum(Matrix, 1)" equivalent to "apply(Matrix, 1, cumsum)" The main advantage could be optimized code if the Matrix is extreme nonsqua