search for: s_k

Displaying 2 results from an estimated 2 matches for "s_k".

Did you mean: s_
2011 Feb 16
1
speed up the code
Hi All, The following is a snippet of my code. It works fine but it is very slow. Is it possible to speed it up by using different data structure or better solution? For 40000 runs, it takes 8 minutes now. Thanks a lot fun_activation = function(s_k, s_hat, x_k, s_hat_len) { common = intersect(s_k, s_hat); if(length(common) != 0) { index = match(common, s_k); round(sum(x_k[index]) * length(common) / (s_hat_len * length(s_k)), 3); } else { 0; } } fun_x = function(a) { round(runif(length...
2012 Mar 20
1
How to write and analyze data with 3 dimensions
Suppose I have data organized in the following way: (P_i, M_j, S_k) where i, j and k and indexes for sets. I would like to analyze the data to get for example the following information: what is the average over k for (P_i, M_j) or what is the average over j and k for P_i. My question is what would be the way of doing this in R. Specifically how should I write th...