1 | #include <iostream> |
---|
2 | #include <Utils/Statistics.hh> |
---|
3 | #include <Utils/utils.hh> |
---|
4 | |
---|
5 | namespace Statistics |
---|
6 | { |
---|
7 | template <class T> Statistics::StatsContainer<T>::StatsContainer(const StatsContainer<T>& s) |
---|
8 | { |
---|
9 | this->defined = s.defined; |
---|
10 | this->mean = s.mean; |
---|
11 | this->stddev = s.stddev; |
---|
12 | this->median = s.median; |
---|
13 | this->madfm = s.madfm; |
---|
14 | this->threshold = s.threshold; |
---|
15 | this->pThreshold = s.pThreshold; |
---|
16 | this->useRobust = s.useRobust; |
---|
17 | this->useFDR = s.useFDR; |
---|
18 | } |
---|
19 | template StatsContainer<int>::StatsContainer(const StatsContainer<int>& s); |
---|
20 | template StatsContainer<long>::StatsContainer(const StatsContainer<long>& s); |
---|
21 | template StatsContainer<float>::StatsContainer(const StatsContainer<float>& s); |
---|
22 | template StatsContainer<double>::StatsContainer(const StatsContainer<double>& s); |
---|
23 | //-------------------------------------------------------------------- |
---|
24 | |
---|
25 | template <class T> Statistics::StatsContainer<T>& StatsContainer<T>::operator= (const StatsContainer<T>& s) |
---|
26 | { |
---|
27 | this->defined = s.defined; |
---|
28 | this->mean = s.mean; |
---|
29 | this->stddev = s.stddev; |
---|
30 | this->median = s.median; |
---|
31 | this->madfm = s.madfm; |
---|
32 | this->threshold = s.threshold; |
---|
33 | this->pThreshold = s.pThreshold; |
---|
34 | this->useRobust = s.useRobust; |
---|
35 | this->useFDR = s.useFDR; |
---|
36 | } |
---|
37 | template StatsContainer<int>& StatsContainer<int>::operator= (const StatsContainer<int>& s); |
---|
38 | template StatsContainer<long>& StatsContainer<long>::operator= (const StatsContainer<long>& s); |
---|
39 | template StatsContainer<float>& StatsContainer<float>::operator= (const StatsContainer<float>& s); |
---|
40 | template StatsContainer<double>& StatsContainer<double>::operator= (const StatsContainer<double>& s); |
---|
41 | //-------------------------------------------------------------------- |
---|
42 | |
---|
43 | template <class T> void Statistics::StatsContainer<T>::calculate(T *array, long size) |
---|
44 | { |
---|
45 | findNormalStats(array, size, this->mean, this->stddev); |
---|
46 | findMedianStats(array, size, this->median, this->madfm); |
---|
47 | this->defined = true; |
---|
48 | } |
---|
49 | template void Statistics::StatsContainer<int>::calculate(int *array, long size); |
---|
50 | template void Statistics::StatsContainer<long>::calculate(long *array, long size); |
---|
51 | template void Statistics::StatsContainer<float>::calculate(float *array, long size); |
---|
52 | template void Statistics::StatsContainer<double>::calculate(double *array, long size); |
---|
53 | //-------------------------------------------------------------------- |
---|
54 | |
---|
55 | template <class T> |
---|
56 | void Statistics::StatsContainer<T>::calculate(T *array, long size, bool *isGood) |
---|
57 | { |
---|
58 | findNormalStats(array, size, isGood, this->mean, this->stddev); |
---|
59 | findMedianStats(array, size, isGood, this->median, this->madfm); |
---|
60 | this->defined = true; |
---|
61 | } |
---|
62 | template void Statistics::StatsContainer<int>::calculate(int *array, long size, bool *isGood); |
---|
63 | template void Statistics::StatsContainer<long>::calculate(long *array, long size, bool *isGood); |
---|
64 | template void Statistics::StatsContainer<float>::calculate(float *array, long size, bool *isGood); |
---|
65 | template void Statistics::StatsContainer<double>::calculate(double *array, long size, bool *isGood); |
---|
66 | //-------------------------------------------------------------------- |
---|
67 | |
---|
68 | template <class T> |
---|
69 | std::ostream& operator<< (std::ostream& theStream, StatsContainer<T> &s) |
---|
70 | { |
---|
71 | theStream << "Mean = " << s.mean << "\t" |
---|
72 | << "Std.Dev. = " << s.stddev << "\n" |
---|
73 | << "Median = " << s.median << "\t" |
---|
74 | << "MADFM = " << s.madfm << "\n"; |
---|
75 | } |
---|
76 | template std::ostream& operator<<<int> (std::ostream& theStream, StatsContainer<int> &s); |
---|
77 | template std::ostream& operator<<<long> (std::ostream& theStream, StatsContainer<long> &s); |
---|
78 | template std::ostream& operator<<<float> (std::ostream& theStream, StatsContainer<float> &s); |
---|
79 | template std::ostream& operator<<<double> (std::ostream& theStream, StatsContainer<double> &s); |
---|
80 | |
---|
81 | |
---|
82 | |
---|
83 | } // matches: namespace Statistics { |
---|