Skip to content

Commit

Permalink
Predict is fast again
Browse files Browse the repository at this point in the history
  • Loading branch information
gvegayon committed Oct 5, 2023
1 parent f05adbe commit 279098f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions include/barry/model-meat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,10 @@ inline void Model<Array_Type,Data_Counter_Type,Data_Rule_Type, Data_Rule_Dyn_Typ
int i
) {

update_normalizing_constants(params, ncores);
update_normalizing_constants(params, ncores, i);

if (i > -1)
params_last[i] = params;

size_t n_params = params.size();
pset_probs.resize(
Expand Down Expand Up @@ -1402,10 +1405,7 @@ Model<Array_Type,Data_Counter_Type,Data_Rule_Type, Data_Rule_Dyn_Type>::sample(

// Updating the current pset
if (pset_probs.size() == 0u)
{
update_pset_probs(params, 1u, static_cast<int>(a));
params_last[a] = params;
}

// Sampling an array
size_t j = 0u;
Expand All @@ -1423,7 +1423,6 @@ Model<Array_Type,Data_Counter_Type,Data_Rule_Type, Data_Rule_Dyn_Type>::sample(
} else {

update_pset_probs(params, 1u, static_cast<int>(a));
params_last[a] = params;

const double * probs = &pset_probs[pset_locations[a]];
while (cumprob < r)
Expand Down

0 comments on commit 279098f

Please sign in to comment.