Dear R users...

I made the R-code for this double summation computation
http://www.nabble.com/file/p19213463/doublesum.jpg 


-------------------------------------------------
Here is my code..


sum(sapply(1:m, function(k){sum(sapply(1:m,
function(j){x[k]*x[j]*dnorm((mu[j]+mu[k])/sqrt(sig[k]+sig[j]))/sqrt(sig[k]+sig[j])}))}))


-------------------------------------------------

In fact, this is a part of optimization. I think if it is changed more
efficiently, then the running time could be reduced.

How could I change this to more efficient one? Any suggestion will be
greatly appreciated.

Kathryn Lord



-- 
View this message in context: 
http://www.nabble.com/more-efficient-double-sum-computation-...-tp19213463p19213463.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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, reproducible code.

Reply via email to