-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathData.hpp
59 lines (41 loc) · 1.13 KB
/
Data.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Data.hpp
// Age Structured Assessment Modeling System (ASAMS)
#ifndef Data_h
#define Data_h
#include "Distributions.hpp"
#include <vector>
namespace asams{
template <class T>
class data_base{
public:
std::vector<T> data_m;
std::vector<int> sample_size_m;
std::vector<T> cv_m;
int imax_m;
int jmax_m;
asams::DistributionBase <T> * prior_distribution;
data_base(int imax, int jmax = 1)
:imax_m(imax), jmax_m(jmax){
data_m.resize(imax * jmax+1);
sample_size_m.resize(imax);
cv_m.resize(imax);
std::fill(this->data_m.begin(), this->data_m.end(), T());
}
T& operator ()(int i, int j = 1){
return data_m[i * jmax_m + j]; // dimension folding
}
};
template <class T>
class index_data:public data_base<T>{
public:
index_data(int nyears):data_base<T>(nyears){
}
};
template <class T>
class agecomp_data:public data_base<T>{
public:
agecomp_data(int nyears, int nage):data_base<T>(nyears, nage){
}
};
}
#endif /* Data_h */