[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r18284 - gnunet/src/nse
From: |
gnunet |
Subject: |
[GNUnet-SVN] r18284 - gnunet/src/nse |
Date: |
Wed, 23 Nov 2011 19:48:46 +0100 |
Author: grothoff
Date: 2011-11-23 19:48:46 +0100 (Wed, 23 Nov 2011)
New Revision: 18284
Modified:
gnunet/src/nse/gnunet-service-nse.c
Log:
fixing variance calculation - we calculate the average from the same
distribution, so the degrees of freedom is n-1
Modified: gnunet/src/nse/gnunet-service-nse.c
===================================================================
--- gnunet/src/nse/gnunet-service-nse.c 2011-11-23 17:23:52 UTC (rev 18283)
+++ gnunet/src/nse/gnunet-service-nse.c 2011-11-23 18:48:46 UTC (rev 18284)
@@ -349,7 +349,7 @@
for (i = 0; i < estimate_count; i++)
{
- int j;
+ unsigned int j;
j = (estimate_index - i + HISTORY_SIZE) % HISTORY_SIZE;
val = htonl (size_estimate_messages[j].matching_bits);
@@ -359,9 +359,9 @@
if (0 != estimate_count)
{
mean = sum / estimate_count;
- variance = (vsq - mean * sum) / estimate_count; // terrible for numerical
stability...
+ variance = (vsq - mean * sum) / (estimate_count - 1.0); // terrible for
numerical stability...
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "(%f - %f) / %u = %f\n",
- vsq, mean * sum, estimate_count, variance);
+ vsq, mean * sum, estimate_count - 1, variance);
}
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r18284 - gnunet/src/nse,
gnunet <=