Skip to content
Snippets Groups Projects
Commit ff1d2569 authored by Peter Jentsch's avatar Peter Jentsch
Browse files

remove inbounds checks, fix bug in edge sampling

parent 04430323
No related branches found
No related tags found
No related merge requests found
......@@ -36,7 +36,7 @@ Resample all the weights in `mixing_graph`
function sample_mixing_graph!(mixing_graph)
mixing_edges = mixing_graph.mixing_edges
for i in 1:size(mixing_edges.contact_array)[1], j in 1:i #diagonal
rand!(RNG, mixing_edges.sampler_matrix[demo_i,demo_j],mixing_edges.sample_cache[i,j])
rand!(RNG, mixing_edges.sampler_matrix[i,j],mixing_edges.sample_cache[i,j])
for k in 1:length(mixing_edges.contact_array[i,j][1])
kth_node_i = mixing_edges.contact_array[i,j][1][k]
kth_node_j = mixing_edges.contact_array[i,j][2][k]
......
......@@ -2,7 +2,7 @@
function contact_weight(p, contact_time)
return 1 - (1-p)^contact_time
end
function update_alert_durations!(t,modelsol)
Base.@propagate_inbounds @views function update_alert_durations!(t,modelsol)
@unpack notification_parameter = modelsol.params
@unpack time_of_last_alert, app_user_index,inf_network,covid_alert_times,app_user = modelsol
for (i,node) in enumerate(modelsol.app_user_index), mixing_graph in modelsol.inf_network.graph_list[t]
......@@ -21,7 +21,7 @@ function update_alert_durations!(t,modelsol)
end
end
function update_infection_state!(t,modelsol)
Base.@propagate_inbounds @views function update_infection_state!(t,modelsol)
@unpack base_transmission_probability,immunization_loss_prob,recovery_rate = modelsol.params
@unpack u_inf,u_vac,u_next_inf,u_next_vac,demographics,inf_network,status_totals = modelsol
......@@ -64,7 +64,7 @@ function update_infection_state!(t,modelsol)
end
# display(u_next_inf)
end
function update_vaccination_opinion_state!(t,modelsol,total_infections)
Base.@propagate_inbounds @views function update_vaccination_opinion_state!(t,modelsol,total_infections)
@unpack π_base, η,γ, κ, ω, ρ, ω_en,ρ_en,γ,β = modelsol.params
@unpack demographics,time_of_last_alert, nodes, soc_network,u_vac,u_next_vac,app_user,app_user_list = modelsol
......@@ -116,7 +116,7 @@ function agents_step!(t,modelsol)
remake!(modelsol.inf_network,modelsol.index_vectors,modelsol.ws_matrix_tuple.daily)
remake!(modelsol.soc_network,modelsol.index_vectors,modelsol.rest_matrix_tuple.daily)
for network in modelsol.inf_network.graph_list[t]
sample_mixing_graph!(network,modelsol.demographics) #get new contact weights
sample_mixing_graph!(network) #get new contact weights
end
update_alert_durations!(t,modelsol)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment