PowerSum.hpp
Go to the documentation of this file.
1 //==============================================================================
2 //
3 // This file is part of GNSSTk, the ARL:UT GNSS Toolkit.
4 //
5 // The GNSSTk is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published
7 // by the Free Software Foundation; either version 3.0 of the License, or
8 // any later version.
9 //
10 // The GNSSTk is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with GNSSTk; if not, write to the Free Software Foundation,
17 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18 //
19 // This software was developed by Applied Research Laboratories at the
20 // University of Texas at Austin.
21 // Copyright 2004-2022, The Board of Regents of The University of Texas System
22 //
23 //==============================================================================
24 
25 //==============================================================================
26 //
27 // This software was developed by Applied Research Laboratories at the
28 // University of Texas at Austin, under contract to an agency or agencies
29 // within the U.S. Department of Defense. The U.S. Government retains all
30 // rights to use, duplicate, distribute, disclose, or release this software.
31 //
32 // Pursuant to DoD Directive 523024
33 //
34 // DISTRIBUTION STATEMENT A: This software has been approved for public
35 // release, distribution is unlimited.
36 //
37 //==============================================================================
38 
39 #ifndef GNSSTK_POWERSUM_HPP
40 #define GNSSTK_POWERSUM_HPP
41 
42 #include <iostream>
43 #include <list>
44 
45 namespace gnsstk
46 {
48 
49 
57  class PowerSum
58  {
59  public:
60  PowerSum() {clear();}
61 
62  const static int order = 5;
63 
65  void clear() noexcept;
66 
68  void add(double x) noexcept;
69 
75  void subtract(double x) noexcept;
76 
77  typedef std::list<double>::const_iterator dlc_iterator;
78 
80  void add(dlc_iterator b, dlc_iterator e) noexcept;
81 
84  void subtract(dlc_iterator b, dlc_iterator e) noexcept;
85 
87  double moment(int i) const noexcept;
88 
90  long size() const noexcept {return n;}
91 
93  double average() const noexcept;
94  double variance() const noexcept;
95  double skew() const noexcept;
96  double kurtosis() const noexcept;
97 
98  void dump(std::ostream& str) const noexcept;
99 
100  private:
101  double s[order+1];
102  long n;
103 /*
104  These are used to determine kurtosis values for specific confidence based upon
105  the sample size.
106  const double pnt[]={
107  5, 7, 8, 9, 10, 12, 15, 20, 25,
108  30, 40, 50, 75, 100, 200, 500, 1000, 1e5, 1.e30};
109  // 5% critical values
110  const double cv5[] = {
111  2.90, 3.55, 3.70, 3.86, 3.95, 4.05, 4.13, 4.17, 4.16,
112  4.11, 4.06, 3.99, 3.87, 3.77, 3.57, 3.37, 3.26, 3.10, 3.00};
113  // 1% critical values
114  const double cv1[]= {
115  3.10, 4.23, 4.53, 4.82, 5.00, 5.20, 5.30, 5.36, 5.30,
116  5.21, 5.04, 4.88, 4.59, 4.39, 3.98, 3.60, 3.41, 3.20, 3.00};
117 */
118  };
119 
121 
122 }
123 #endif
gnsstk::PowerSum::clear
void clear() noexcept
Reset all sums.
Definition: PowerSum.cpp:44
gnsstk::PowerSum::s
double s[order+1]
Definition: PowerSum.hpp:101
gnsstk::PowerSum::moment
double moment(int i) const noexcept
Computes the ith order central moment.
Definition: PowerSum.cpp:83
const
#define const
Definition: getopt.c:43
gnsstk::PowerSum::subtract
void subtract(double x) noexcept
Definition: PowerSum.cpp:59
gnsstk::PowerSum::variance
double variance() const noexcept
Definition: PowerSum.cpp:115
gnsstk::PowerSum::size
long size() const noexcept
Reuturn the number of points in the current sum.
Definition: PowerSum.hpp:90
gnsstk::PowerSum::add
void add(double x) noexcept
Add a single value to the sums.
Definition: PowerSum.cpp:51
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::PowerSum::dump
void dump(std::ostream &str) const noexcept
Definition: PowerSum.cpp:137
gnsstk::PowerSum::n
long n
Definition: PowerSum.hpp:102
gnsstk::PowerSum::dlc_iterator
std::list< double >::const_iterator dlc_iterator
Definition: PowerSum.hpp:77
gnsstk::PowerSum
Definition: PowerSum.hpp:57
gnsstk::PowerSum::kurtosis
double kurtosis() const noexcept
Definition: PowerSum.cpp:129
gnsstk::PowerSum::order
const static int order
Definition: PowerSum.hpp:62
std
Definition: Angle.hpp:142
gnsstk::PowerSum::skew
double skew() const noexcept
Definition: PowerSum.cpp:122
gnsstk::PowerSum::average
double average() const noexcept
Computes the indicated value.
Definition: PowerSum.cpp:107
gnsstk::PowerSum::PowerSum
PowerSum()
Definition: PowerSum.hpp:60


gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:40