[R] make a triple summation more efficient
kathie
kathryn.lord2000 at gmail.com
Sat Nov 15 17:39:48 CET 2008
Dear R users...
I made the R-code for this triple summation computation
http://www.nabble.com/file/p20517134/a.jpg
-------------------------------------------------
Here is my code..
x=seq(.1,1,.1); l=10
y=seq(1,10); m=10
z=seq(.1,1,.1); n=10
sum(sapply(1:l, function(i) {sum(sapply(1:m, function(j) {sum(sapply(1:n,
function(k){exp(x[i]*y[j]*z[k] )/gamma(y[j]+1)}))^(1.5) }))}))
-------------------------------------------------
In fact, this is a part of optimization. I guess if it is vectorized, then
the running time could be shortened.
How could I vectorize this? or any suggestion will be greatly appreciated.
Kathryn Lord
--
View this message in context: http://www.nabble.com/make-a-triple-summation-more-efficient-tp20517134p20517134.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list