Displaying 1 result from an estimated 1 matches for "symbol_len".
Did you mean:
symbol_end
2011 Feb 16
1
speed up the code
..._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(a), 0, 1), 2);
}
symbol_len = 50;
PHI_set = 1:symbol_len;
S = matrix(replicate(M * M, sort(sample(PHI_set, sample(symbol_len, 1)))), M, M);
X = matrix(mapply(fun_x, S), M, M);
S_hat = c(28, 34, 35)
S_hat_len = length(S_hat);
S_hat_matrix = matrix(list(S_hat), M, M);
system.time(
for(I in 1:40000)
{
A = matrix(mapply(fun...