Skip to content

Commit

Permalink
initialize years_since_vac_update counter to 1
Browse files Browse the repository at this point in the history
  • Loading branch information
kylieainslie committed Feb 17, 2022
1 parent ad7575a commit 93b9c49
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/vaccine_update_cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ List vaccine_update_cpp(NumericMatrix drift, double threshold, double vac_protec

NumericVector vaccine_dist(drift.nrow());
IntegerVector update(drift.nrow());
int years_since_vac_update = 0;
int years_since_vac_update = 1;
NumericVector gammas(drift.nrow());
// set initial values of vaccine_dist and update vectors
vaccine_dist[0] = 0;
Expand All @@ -25,7 +25,7 @@ List vaccine_update_cpp(NumericMatrix drift, double threshold, double vac_protec
vaccine_dist[j] = drift(j, j - years_since_vac_update);
if(vaccine_dist[j] > threshold){
update[j] = 1; // update vaccine
years_since_vac_update = 0; // change years since vac update to 0 if updated in current year
years_since_vac_update = 1; // change years since vac update to 0 if updated in current year
// vaccine_dist = 0; // reset vaccine_dist to 0
gammas[j] = 1-vac_protect; // set protection from vaccination to 1-VE
} else {
Expand Down

0 comments on commit 93b9c49

Please sign in to comment.