Bugzilla – Full Text Bug Listing |
Summary: | Stddev (average.h) returning NaN | ||
---|---|---|---|
Product: | ns-3 | Reporter: | Tom Henderson <tomh> |
Component: | stats | Assignee: | Mitch Watrous <watrous> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | ns-bugs, tjkopena |
Priority: | P5 | ||
Version: | pre-release | ||
Hardware: | All | ||
OS: | All |
Description
Tom Henderson
2011-12-14 13:13:12 EST
Just to summarize (and maybe close) this bug. The analysis is wrong, as in "Count () / (double)(Count () - 1) * (m_avg2 - m_avg*m_avg)" the "(m_avg2 - m_avg*m_avg)" part is not at denominator. The above code will return: - 0 for Count = 0 (kinda stupid, but still) - NaN for Count = 1 (it's expected and should be) - a value, in all the other cases, with the special case: -- 0 for a constant input (and this is as expected too). Note that in the last case it is possible to have a near-zero result due to finite precision arithmetic. Anyway, the issue remains, as we do have two different places where the calcs are done in slightly different ways. My proposal (at the time and now) is to merge them. Sadly, it's not that simple. Checking the two implementations, one can see that: 1) the one in stats/model/basic-data-calculators.h is more complete (does more things) and it's also more precise, as it's implementing exactly the well-known Knuth's algorithm. 2) the one in tools/model/average.h is a more naive implementation (although not totally wrong) and might lead to drifts for large sequences. So the obvious conclusion would be to use the basic-data-calculators.h one, but it's in a module and the dependencies would be not right. So the only left solution is: a) pick the basic-data-calculators.h algorithm and improve the one in average.h b) have basic-data-calculators.h rely on average.h functions c) close this. Anybody feeling like to do it ? Cheers, T. Bug closed. ns-3-dev changeset: f794f31dc0be Considering that in tools module there is: module = bld.create_ns3_module('tools', ['network']) and in stats module there is: obj = bld.create_ns3_module('stats', ['network']) there is no apparent dependency. However there is. Shouldn't the tools one be: module = bld.create_ns3_module('tools', ['network', 'stats']) ? Cheers, T. (In reply to comment #3) > Considering that in tools module there is: > module = bld.create_ns3_module('tools', ['network']) > > and in stats module there is: > obj = bld.create_ns3_module('stats', ['network']) > > there is no apparent dependency. However there is. > > Shouldn't the tools one be: > module = bld.create_ns3_module('tools', ['network', 'stats']) ? > > Cheers, > > T. I did just what you suggested. Here is the relevant line from src/tools/wscript that specifies the tools module's dependencies: module = bld.create_ns3_module('tools', ['network', 'stats']) Sry, didn't see that line. Nvm :) Ty, |