Numworks Epsilon  1.4.1
Graphing Calculator Operating System
store.h
Go to the documentation of this file.
1 #ifndef STATISTICS_STORE_H
2 #define STATISTICS_STORE_H
3 
4 #include "../shared/memoized_curve_view_range.h"
5 #include "../shared/float_pair_store.h"
6 
7 namespace Statistics {
8 
10 public:
11  Store();
13  // Histogram bars
14  double barWidth();
15  void setBarWidth(double barWidth);
16  double firstDrawnBarAbscissa();
18  double heightOfBarAtIndex(int index);
19  double heightOfBarAtValue(double value);
20  double startOfBarAtIndex(int index);
21  double endOfBarAtIndex(int index);
22  double numberOfBars();
23  // return true if the window has scrolled
24  bool scrollToSelectedBarIndex(int index);
25 
26  // Calculation
27  double sumOfOccurrences();
28  double maxValue();
29  double minValue();
30  double range();
31  double mean();
32  double variance();
33  double standardDeviation();
34  double sampleStandardDeviation();
35  double firstQuartile();
36  double thirdQuartile();
37  double quartileRange();
38  double median();
39  double sum();
40  double squaredValueSum();
41  constexpr static double k_maxNumberOfBars = 10000.0;
42  constexpr static float k_displayTopMarginRatio = 0.1f;
43  constexpr static float k_displayRightMarginRatio = 0.04f;
44  constexpr static float k_displayBottomMarginRatio = 0.4f;
45  constexpr static float k_displayLeftMarginRatio = 0.04f;
46 private:
47  double defaultValue(int i, int j) override;
48  double sumOfValuesBetween(double x1, double x2);
49  double sortedElementNumber(int k);
50  int minIndex(double * bufferValues, int bufferLength);
51  // Histogram bars
52  double m_barWidth;
53  double m_firstDrawnBarAbscissa;
54 };
55 
56 typedef double (Store::*CalculPointer)();
57 
58 }
59 
60 #endif
double sumOfOccurrences()
Definition: store.cpp:94
static constexpr float k_displayLeftMarginRatio
Definition: store.h:45
double heightOfBarAtValue(double value)
Definition: store.cpp:52
void setFirstDrawnBarAbscissa(double firstDrawnBarAbscissa)
Definition: store.cpp:44
uint32_t barChecksum()
Definition: store.cpp:20
static constexpr float k_displayRightMarginRatio
Definition: store.h:43
double maxValue()
Definition: store.cpp:98
double barWidth()
Definition: store.cpp:29
double standardDeviation()
Definition: store.cpp:131
double heightOfBarAtIndex(int index)
Definition: store.cpp:48
double sum()
Definition: store.cpp:168
double firstDrawnBarAbscissa()
Definition: store.cpp:40
double numberOfBars()
Definition: store.cpp:69
double endOfBarAtIndex(int index)
Definition: store.cpp:65
static constexpr float k_displayBottomMarginRatio
Definition: store.h:44
double range()
Definition: store.cpp:118
double minValue()
Definition: store.cpp:108
double median()
Definition: store.cpp:155
unsigned int uint32_t
Definition: stdint.h:6
static constexpr float k_displayTopMarginRatio
Definition: store.h:42
void setBarWidth(double barWidth)
Definition: store.cpp:33
double sampleStandardDeviation()
Definition: store.cpp:135
double firstQuartile()
Definition: store.cpp:141
static constexpr double k_maxNumberOfBars
Definition: store.h:41
double(Store::* CalculPointer)()
Definition: store.h:56
double quartileRange()
Definition: store.cpp:151
double thirdQuartile()
Definition: store.cpp:146
double mean()
Definition: store.cpp:122
bool scrollToSelectedBarIndex(int index)
Definition: store.cpp:74
double startOfBarAtIndex(int index)
Definition: store.cpp:60
double squaredValueSum()
Definition: store.cpp:176
double variance()
Definition: store.cpp:126