epinowcast
Loading...
Searching...
No Matches
allocate_observed_obs.stan
Go to the documentation of this file.
1
31vector allocate_observed_obs(int start, int end, vector obs,
32 array[] int sl, array[] int csl,
33 array[] int sdmax, array[] int csdmax) {
34 array[3] int n = filt_obs_indexes(start, end, csl, sl);
35 vector[n[3]] alloc_obs;
36 // Declare once outside loop to avoid repeated allocation
37 array[3] int l;
38 array[3] int f;
39 for (i in start:end) {
40 l = filt_obs_indexes(i, i, csl, sl);
41 f = filt_obs_indexes(i, i, csdmax, sdmax);
42 alloc_obs[l[1]:l[2]] = segment(obs, f[1], sl[i]);
43 }
44 return(alloc_obs);
45}
46
47array[] int allocate_observed_obs(int start, int end, array[] int obs,
48 array[] int sl, array[] int csl,
49 array[] int sdmax, array[] int csdmax) {
50 array[3] int n = filt_obs_indexes(start, end, csl, sl);
51 array[n[3]] int alloc_obs;
52 // Declare once outside loop to avoid repeated allocation
53 array[3] int l;
54 array[3] int f;
55 for (i in start:end) {
56 l = filt_obs_indexes(i, i, csl, sl);
57 f = filt_obs_indexes(i, i, csdmax, sdmax);
58 alloc_obs[l[1]:l[2]] = segment(obs, f[1], sl[i]);
59 }
60 return(alloc_obs);
61}
vector allocate_observed_obs(int start, int end, vector obs, array[] int sl, array[] int csl, array[] int sdmax, array[] int csdmax)
array[] int filt_obs_indexes(int start, int end, array[] int csl, array[] int sl)