Simple class to find the most common value, within a given tolerance, in a given set of values. Used to find, e.g. the time interval of a RINEX obs file. Given enough examples (provided to add(dt)), it should be clear what the nominal or most common value is. Use a tolerance to differentiate dt's, default 0.001.
Definition at line 59 of file MostCommonValue.hpp.
#include <MostCommonValue.hpp>
Public Member Functions | |
void | add (double dt) |
add a measured timestep to the analysis More... | |
double | bestDT () |
return the best estimate of timestep More... | |
int | bestN () |
return count for best estimate More... | |
void | dump (std::ostream &os, int prec=3) |
dump the table of values and counts More... | |
void | getResults (std::vector< int > &out_counts, std::vector< double > &out_values) |
get the table of all the values and the number of times seen More... | |
double | getTol () |
access the tolerance used in comparing timesteps More... | |
MostCommonValue (int i=DEFAULT_DIM) | |
void | reset (int i=DEFAULT_DIM) |
reset More... | |
void | setTol (double t) |
set the tolerance used in comparing timesteps More... | |
Private Attributes | |
std::vector< int > | counts |
number of times this value has been seen More... | |
int | N |
number of different values to be considered More... | |
double | tol |
tolerance in comparing input to values[] More... | |
std::vector< double > | values |
value being considered - parallel to counts More... | |
|
inline |
only ctor; argument is the maximum number of values to remember and count (9)
Definition at line 73 of file MostCommonValue.hpp.
|
inline |
add a measured timestep to the analysis
Definition at line 84 of file MostCommonValue.hpp.
|
inline |
return the best estimate of timestep
Definition at line 122 of file MostCommonValue.hpp.
|
inline |
return count for best estimate
Definition at line 138 of file MostCommonValue.hpp.
|
inline |
dump the table of values and counts
Definition at line 168 of file MostCommonValue.hpp.
|
inline |
get the table of all the values and the number of times seen
Definition at line 160 of file MostCommonValue.hpp.
|
inline |
access the tolerance used in comparing timesteps
Definition at line 154 of file MostCommonValue.hpp.
|
inline |
reset
Definition at line 76 of file MostCommonValue.hpp.
|
inline |
set the tolerance used in comparing timesteps
Definition at line 157 of file MostCommonValue.hpp.
|
private |
number of times this value has been seen
Definition at line 63 of file MostCommonValue.hpp.
|
private |
number of different values to be considered
Definition at line 61 of file MostCommonValue.hpp.
|
private |
tolerance in comparing input to values[]
Definition at line 62 of file MostCommonValue.hpp.
|
private |
value being considered - parallel to counts
Definition at line 64 of file MostCommonValue.hpp.