rdbstats  2.0.7
RdbStatsPercentiles.h
1 #ifndef RdbStatsPercentiles_H
2 #define RdbStatsPercentiles_H
3 
4 /* --8<--8<--8<--8<--
5  *
6  * Copyright (C) 2006 Smithsonian Astrophysical Observatory
7  *
8  * This file is part of rdbstats
9  *
10  * rdbstats is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * rdbstats is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the
22  * Free Software Foundation, Inc.
23  * 51 Franklin Street, Fifth Floor
24  * Boston, MA 02110-1301, USA
25  *
26  * -->8-->8-->8-->8-- */
27 
28 #include <string>
29 #include <vector>
30 
31 #include "RdbStats.h"
32 
37 class RdbStatsPercentiles : public RdbStats {
38 
39 public:
40 
41  // The user has specified the percentile to use:
43  RdbStatsPercentiles( RDB& irdbtable, const std::string& name,
44  const std::string& percent_list, bool implicitquartile );
45 
46  // --quartiles
47  RdbStatsPercentiles( RDB& irdbtable, const std::string& name );
48 
49  virtual int calculate_statistics( );
50 
51  void init( );
52 
53  virtual void normalize_results( const double norm );
54 
55  void set_output_columns( RDB& ordbtable );
56 
57  virtual void update_statistics( );
58 
59 protected:
60 
61  std::vector< double > data;
62 
63  std::vector< std::pair< std::string, double > > the_percentile;
64 
65  double the_median;
66 
67  std::vector<double> the_percentile_result;
68 
69 private:
70 
72  double calculate_median( );
73 
75  double calculate_percentile( const double percentile );
76 
77 };
78 
79 #endif
The base class to calculate : average, maximum, minimum, num, stddev and sum.
Definition: RdbStats.h:39
virtual void update_statistics()
Read the column from RDB++, update the statistics for the column.
RdbStatsPercentiles(RDB &irdbtable, const std::string &name, const std::string &percent_list, bool implicitquartile)
–percentiles 12,34.. and –quartile
virtual int calculate_statistics()
Perform the final statistic for the set.
A class to calculate the percentiles, RdbStatsPercentiles isA special case of the class RdbStats.