diff options
Diffstat (limited to 'src/rps/rps-sampler_client.c')
-rw-r--r-- | src/rps/rps-sampler_client.c | 69 |
1 files changed, 35 insertions, 34 deletions
diff --git a/src/rps/rps-sampler_client.c b/src/rps/rps-sampler_client.c index 5ab854e01..f6e98ce29 100644 --- a/src/rps/rps-sampler_client.c +++ b/src/rps/rps-sampler_client.c @@ -258,39 +258,39 @@ RPS_sampler_mod_init (size_t init_size, } -/** - * @brief Compute the probability that we already observed all peers from a - * biased stream of peer ids. - * - * Deficiency factor: - * As introduced by Brahms: Factor between the number of unique ids in a - * truly random stream and number of unique ids in the gossip stream. - * - * @param num_peers_estim The estimated number of peers in the network - * @param num_peers_observed The number of peers the given element has observed - * @param deficiency_factor A factor that catches the 'bias' of a random stream - * of peer ids - * - * @return The estimated probability - */ -static double -prob_observed_n_peers (uint32_t num_peers_estim, - uint32_t num_peers_observed, - double deficiency_factor) -{ - uint32_t num_peers = num_peers_estim * (1 / deficiency_factor); - uint64_t sum = 0; - - for (uint32_t i = 0; i < num_peers; i++) - { - uint64_t a = pow (-1, num_peers - i); - uint64_t b = binom (num_peers, i); - uint64_t c = pow (i, num_peers_observed); - sum += a * b * c; - } - - return sum / (double) pow (num_peers, num_peers_observed); -} +// /** +// * @brief Compute the probability that we already observed all peers from a +// * biased stream of peer ids. +// * +// * Deficiency factor: +// * As introduced by Brahms: Factor between the number of unique ids in a +// * truly random stream and number of unique ids in the gossip stream. +// * +// * @param num_peers_estim The estimated number of peers in the network +// * @param num_peers_observed The number of peers the given element has observed +// * @param deficiency_factor A factor that catches the 'bias' of a random stream +// * of peer ids +// * +// * @return The estimated probability +// */ +// static double +// prob_observed_n_peers (uint32_t num_peers_estim, +// uint32_t num_peers_observed, +// double deficiency_factor) +// { +// uint32_t num_peers = num_peers_estim * (1 / deficiency_factor); +// uint64_t sum = 0; +// +// for (uint32_t i = 0; i < num_peers; i++) +// { +// uint64_t a = pow (-1, num_peers - i); +// uint64_t b = binom (num_peers, i); +// uint64_t c = pow (i, num_peers_observed); +// sum += a * b * c; +// } +// +// return sum / (double) pow (num_peers, num_peers_observed); +// } /** @@ -379,7 +379,8 @@ sampler_mod_get_rand_peer (void *cls) return; } /* compute probability */ - /* Currently disabled due to numerical limitations */ + /* FIXME: Currently disabled due to numerical limitations */ + prob_observed_n = 0; // Inititialise to some value // prob_observed_n = prob_observed_n_peers (sampler->num_peers_estim, // s_elem->num_peers, // sampler->deficiency_factor); |