Histogram. More...
#include <SgStatistics.h>
Public Member Functions | |
SgHistogram () | |
SgHistogram (VALUE min, VALUE max, int bins) | |
void | Init (VALUE min, VALUE max, int bins) |
Reinitialize and clear histogram. | |
void | Add (VALUE value) |
void | Clear () |
int | Bins () const |
COUNT | Count () const |
COUNT | Count (int i) const |
Get count in a certain bin. | |
void | Write (std::ostream &out) const |
Write as x,y-table. | |
void | WriteWithLabels (std::ostream &out, const std::string &label) const |
Write with labels. | |
Private Types | |
typedef std::vector< COUNT > | Vector |
Private Attributes | |
int | m_bins |
COUNT | m_count |
VALUE | m_binSize |
VALUE | m_min |
VALUE | m_max |
Vector | m_array |
Histogram.
The template parameters are the floating point type and the counter type, depending on the precision-memory tradeoff.
Definition at line 597 of file SgStatistics.h.
typedef std::vector<COUNT> SgHistogram< VALUE, COUNT >::Vector [private] |
Definition at line 636 of file SgStatistics.h.
SgHistogram< VALUE, COUNT >::SgHistogram | ( | ) |
Definition at line 652 of file SgStatistics.h.
References SgHistogram< VALUE, COUNT >::Init().
SgHistogram< VALUE, COUNT >::SgHistogram | ( | VALUE | min, | |
VALUE | max, | |||
int | bins | |||
) |
Definition at line 658 of file SgStatistics.h.
References SgHistogram< VALUE, COUNT >::Init().
void SgHistogram< VALUE, COUNT >::Add | ( | VALUE | value | ) |
Definition at line 664 of file SgStatistics.h.
References SgHistogram< VALUE, COUNT >::m_array, SgHistogram< VALUE, COUNT >::m_bins, SgHistogram< VALUE, COUNT >::m_binSize, SgHistogram< VALUE, COUNT >::m_count, and SgHistogram< VALUE, COUNT >::m_min.
int SgHistogram< VALUE, COUNT >::Bins | ( | ) | const |
Definition at line 676 of file SgStatistics.h.
References SgHistogram< VALUE, COUNT >::m_bins.
void SgHistogram< VALUE, COUNT >::Clear | ( | ) |
Definition at line 682 of file SgStatistics.h.
References SgHistogram< VALUE, COUNT >::m_array, and SgHistogram< VALUE, COUNT >::m_count.
Referenced by SgHistogram< VALUE, COUNT >::Init().
COUNT SgHistogram< VALUE, COUNT >::Count | ( | ) | const |
Definition at line 691 of file SgStatistics.h.
References SgHistogram< VALUE, COUNT >::m_count.
COUNT SgHistogram< VALUE, COUNT >::Count | ( | int | i | ) | const |
Get count in a certain bin.
Definition at line 697 of file SgStatistics.h.
References SgHistogram< VALUE, COUNT >::m_array, SgHistogram< VALUE, COUNT >::m_bins, and SG_ASSERT.
void SgHistogram< VALUE, COUNT >::Init | ( | VALUE | min, | |
VALUE | max, | |||
int | bins | |||
) |
Reinitialize and clear histogram.
Definition at line 705 of file SgStatistics.h.
References SgHistogram< VALUE, COUNT >::Clear(), SgHistogram< VALUE, COUNT >::m_array, SgHistogram< VALUE, COUNT >::m_bins, SgHistogram< VALUE, COUNT >::m_binSize, SgHistogram< VALUE, COUNT >::m_max, and SgHistogram< VALUE, COUNT >::m_min.
Referenced by SgHistogram< VALUE, COUNT >::SgHistogram().
void SgHistogram< VALUE, COUNT >::Write | ( | std::ostream & | out | ) | const |
Write as x,y-table.
Writes the historgram in a format that likely can be used by other programs. Writes one x,y pair per line. The separator is TAB. The x-values are the left border values of the bins, the y-values are the counts of the bins.
Definition at line 716 of file SgStatistics.h.
References SgHistogram< VALUE, COUNT >::m_array, SgHistogram< VALUE, COUNT >::m_bins, SgHistogram< VALUE, COUNT >::m_binSize, and SgHistogram< VALUE, COUNT >::m_min.
void SgHistogram< VALUE, COUNT >::WriteWithLabels | ( | std::ostream & | out, | |
const std::string & | label | |||
) | const |
Write with labels.
Example output with label "Value", the numbers in brackets are the left border of each bin:
Value[0] 100 Value[10] 2000 Value[20] 500
Definition at line 724 of file SgStatistics.h.
References SgHistogram< VALUE, COUNT >::m_array, SgHistogram< VALUE, COUNT >::m_bins, SgHistogram< VALUE, COUNT >::m_binSize, and SgHistogram< VALUE, COUNT >::m_min.
Vector SgHistogram< VALUE, COUNT >::m_array [private] |
int SgHistogram< VALUE, COUNT >::m_bins [private] |
VALUE SgHistogram< VALUE, COUNT >::m_binSize [private] |
Definition at line 642 of file SgStatistics.h.
Referenced by SgHistogram< VALUE, COUNT >::Add(), SgHistogram< VALUE, COUNT >::Init(), SgHistogram< VALUE, COUNT >::Write(), and SgHistogram< VALUE, COUNT >::WriteWithLabels().
COUNT SgHistogram< VALUE, COUNT >::m_count [private] |
Definition at line 640 of file SgStatistics.h.
Referenced by SgHistogram< VALUE, COUNT >::Add(), SgHistogram< VALUE, COUNT >::Clear(), and SgHistogram< VALUE, COUNT >::Count().
VALUE SgHistogram< VALUE, COUNT >::m_max [private] |
Definition at line 646 of file SgStatistics.h.
Referenced by SgHistogram< VALUE, COUNT >::Init().
VALUE SgHistogram< VALUE, COUNT >::m_min [private] |
Definition at line 644 of file SgStatistics.h.
Referenced by SgHistogram< VALUE, COUNT >::Add(), SgHistogram< VALUE, COUNT >::Init(), SgHistogram< VALUE, COUNT >::Write(), and SgHistogram< VALUE, COUNT >::WriteWithLabels().