Re: [R] Is it possible to vectorize/accelerate this?

2011-11-03 Thread hihi
Thank you, I will try as soon as possible... Regards, Peter 2011/11/3 Mark Leeds > hi hihi: you're not using the ifelse construct correctly because it's > already vectorized > so there's no need to use a loop. > > check if below works AND if it's fast enough

[R] Is it possible to vectorize/accelerate this?

2011-11-03 Thread hihi
Dear Members, I work on a simulaton experiment but it has an bottleneck. It's quite fast because of R and vectorizing, but it has a very slow for loop. The adjacent element of a vector (in terms of index number) depends conditionally on the former value of itself. Like a simple cumulating funct

Re: [R] Element by element mean of a list of matrices

2011-03-15 Thread hihi
Thank you all, it will help :-) Bye, Peter __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, repr

[R] Element by element mean of a list of matrices

2011-03-15 Thread hihi
Hi All, is there any effiective and dense/compact method to calculate the mean of a list of - of course coincident - matrices on an element by element basis? The resulting matrix' [i, j]-th element is the mean of the list's matrices' [i, j]-th elements respectively... Iterating by for statement