29 #ifndef TYPES_STAT_HPP 30 #define TYPES_STAT_HPP 49 m_p1Width(0), m_p2Width(0), m_p1Card(0), m_p2Card(0), m_mOrder(0), m_csOrder(0), m_acsOrder(0),
50 m_p1M(nullptr), m_p2M(nullptr), m_p1CS(nullptr), m_p2CS(nullptr), m_p12ACS(nullptr)
55 m_p1Width(0), m_p2Width(0), m_p1Card(0), m_p2Card(0), m_mOrder(0), m_csOrder(0), m_acsOrder(0),
56 m_p1M(nullptr), m_p2M(nullptr), m_p1CS(nullptr), m_p2CS(nullptr), m_p12ACS(nullptr){
64 m_p1Width(0), m_p2Width(0), m_p1Card(0), m_p2Card(0), m_mOrder(0), m_csOrder(0), m_acsOrder(0),
65 m_p1M(nullptr), m_p2M(nullptr), m_p1CS(nullptr), m_p2CS(nullptr), m_p12ACS(nullptr){
74 m_p1Card(other.m_p1Card), m_p2Card(other.m_p2Card),
75 m_mOrder(other.m_mOrder), m_csOrder(other.m_csOrder), m_acsOrder(other.m_acsOrder),
76 m_p1M(std::move(other.m_p1M)), m_p2M(std::move(other.m_p2M)),
77 m_p1CS(std::move(other.m_p1CS)), m_p2CS(std::move(other.m_p2CS)),
78 m_p12ACS(std::move(other.m_p12ACS))
83 m_p1Width = other.m_p1Width;
84 m_p2Width = other.m_p2Width;
85 m_p1Card = other.m_p1Card;
86 m_p2Card = other.m_p2Card;
87 m_mOrder = other.m_mOrder;
88 m_csOrder = other.m_csOrder;
89 m_acsOrder = other.m_acsOrder;
90 m_p1M = std::move(other.m_p1M);
91 m_p2M = std::move(other.m_p2M);
92 m_p1CS = std::move(other.m_p1CS);
93 m_p2CS = std::move(other.m_p2CS);
94 m_p12ACS = std::move(other.m_p12ACS);
101 virtual void init(
size_t firstWidth,
size_t secondWidth,
size_t mOrder,
size_t csOrder,
size_t acsOrder) {
103 if(firstWidth == m_p1Width && secondWidth == m_p2Width &&
mOrder == m_mOrder &&
csOrder == m_csOrder &&
acsOrder == m_acsOrder)
108 m_p1Width = firstWidth;
110 m_p2Width = secondWidth;
119 for(
size_t order = 0; order <
mOrder; order++){
120 m_p1M[order].init(firstWidth);
121 m_p2M[order].init(secondWidth);
125 size_t csLen = (m_csOrder > 1) ? m_csOrder - 1 : 0;
128 for(
size_t order = 0; order < csLen; order++){
129 m_p1CS[order].init(firstWidth);
130 m_p2CS[order].init(secondWidth);
135 for(
size_t order = 0; order <
acsOrder; order++){
136 m_p12ACS[order].init(firstWidth, secondWidth);
139 }
catch (std::bad_alloc & e) {
144 virtual void init(
size_t firstWidth,
size_t secondWidth,
size_t mOrder,
size_t csOrder,
size_t acsOrder, T val) {
151 for(
size_t order = 0; order < m_mOrder; order++){
152 m_p1M[order].fill(val);
153 m_p2M[order].fill(val);
156 size_t csLen = (m_csOrder > 1) ? m_csOrder - 1 : 0;
157 for(
size_t order = 0; order < csLen; order++){
158 m_p1CS[order].fill(val);
159 m_p2CS[order].fill(val);
162 for(
size_t order = 0; order < m_acsOrder; order++){
163 m_p12ACS[order].fill(val);
178 virtual size_t p1Width()
const {
return m_p1Width; }
180 virtual size_t p2Width()
const {
return m_p2Width; }
183 virtual size_t mOrder()
const {
return m_mOrder; }
185 virtual size_t csOrder()
const {
return m_csOrder; }
187 virtual size_t acsOrder()
const {
return m_acsOrder; }
190 virtual size_t &
p1Card() {
return m_p1Card; }
192 virtual const size_t &
p1Card()
const {
return m_p1Card; }
195 virtual size_t &
p2Card() {
return m_p2Card; }
197 virtual const size_t &
p2Card()
const {
return m_p2Card; }
202 virtual const Vector<T> &
p1M(
size_t order)
const {
return m_p1M[order-1]; }
207 virtual const Vector<T> &
p2M(
size_t order)
const {
return m_p2M[order-1]; }
212 virtual const Vector<T> &
p1CS(
size_t order)
const {
return m_p1CS[order-2]; }
217 virtual const Vector<T> &
p2CS(
size_t order)
const {
return m_p2CS[order-2]; }
237 std::unique_ptr<Vector<T>[]> m_p1M;
238 std::unique_ptr<Vector<T>[]> m_p2M;
240 std::unique_ptr<Vector<T>[]> m_p1CS;
241 std::unique_ptr<Vector<T>[]> m_p2CS;
243 std::unique_ptr<Matrix<T>[]> m_p12ACS;
UnivariateContext(size_t firstWidth, size_t secondWidth, size_t mOrder, size_t csOrder, size_t acsOrder, T val)
Constructs an initialized context and fills it with val.
Definition: types_stat.hpp:63
virtual const size_t & p1Card() const
Cardinality of the first population (const)
Definition: types_stat.hpp:192
virtual const Vector< T > & p1CS(size_t order) const
Central moment sum of the first population, order 2 upto csOrder (const)
Definition: types_stat.hpp:212
A class representing a vector, stored in the machine's free space.
Definition: types_basic.hpp:217
A class representing a Two-population Univariate Moment-based statistical context.
Definition: types_stat.hpp:43
UnivariateContext()
Constructs an empty context, needs to be initialized first (init)
Definition: types_stat.hpp:48
virtual Matrix< T > & p12ACS(size_t order)
Adjusted central moment sum both populations, order 1 upto acsOrder.
Definition: types_stat.hpp:220
virtual size_t mOrder() const
Maximum order of the raw moments, 1 upto mOrder.
Definition: types_stat.hpp:183
virtual size_t csOrder() const
Maximum order of the central moment sums, 2 upto csOrder.
Definition: types_stat.hpp:185
UnivariateContext(UnivariateContext &&other)
Move constructor.
Definition: types_stat.hpp:73
virtual void reset()
Fill the whole context with zeroes.
Definition: types_stat.hpp:169
virtual ~UnivariateContext()
Empty destructor.
Definition: types_stat.hpp:99
virtual size_t p2Width() const
Width of the second population.
Definition: types_stat.hpp:180
virtual size_t & p1Card()
Cardinality of the first population.
Definition: types_stat.hpp:190
virtual const size_t & p2Card() const
Cardinality of the second population (const)
Definition: types_stat.hpp:197
virtual size_t p1Width() const
Width of the first population.
Definition: types_stat.hpp:178
virtual const Matrix< T > & p12ACS(size_t order) const
Adjusted central moment sum both populations, order 1 upto acsOrder (const)
Definition: types_stat.hpp:222
virtual size_t acsOrder() const
Maximum order of the adjusted central moment sums, 1 upto acsOrder.
Definition: types_stat.hpp:187
virtual Vector< T > & p2CS(size_t order)
Central moment sum of the second population, order 2 upto csOrder.
Definition: types_stat.hpp:215
This header file contains class templates of basic data containers.
A class representing a matrix, stored in the machine's free space.
Definition: types_basic.hpp:305
virtual const Vector< T > & p2CS(size_t order) const
Central moment sum of the second population, order 2 upto csOrder (const)
Definition: types_stat.hpp:217
virtual const Vector< T > & p2M(size_t order) const
Raw moment of the second population, order 1 upto mOrder (const)
Definition: types_stat.hpp:207
virtual const Vector< T > & p1M(size_t order) const
Raw moment of the first population, order 1 upto mOrder (const)
Definition: types_stat.hpp:202
virtual size_t & p2Card()
Cardinality of the second population.
Definition: types_stat.hpp:195
UnivariateContext & operator=(UnivariateContext &&other)
Move assignment operator.
Definition: types_stat.hpp:82
An abstract class, representing all the computational contexts.
Definition: types_basic.hpp:192
virtual Vector< T > & p1CS(size_t order)
Central moment sum of the first population, order 2 upto csOrder.
Definition: types_stat.hpp:210
virtual Vector< T > & p2M(size_t order)
Raw moment of the second population, order 1 upto mOrder.
Definition: types_stat.hpp:205
An exception which cannot be directly influenced by the user, or predicted beforehand.
Definition: exceptions.hpp:76
UnivariateContext(size_t firstWidth, size_t secondWidth, size_t mOrder, size_t csOrder, size_t acsOrder)
Constructs an initialized context.
Definition: types_stat.hpp:54
virtual void fill(T val)
Fills the context's containers (vectors, matrices,...) with the 'val'.
Definition: types_stat.hpp:149
virtual Vector< T > & p1M(size_t order)
Raw moment of the first population, order 1 upto mOrder.
Definition: types_stat.hpp:200