bayesmix-dev / bayesmix

Flexible Bayesian nonparametric mixture models in C++
https://bayesmix.rtfd.io
BSD 3-Clause "New" or "Revised" License
22 stars 18 forks source link

Segfault correction in Split&Merge algorithm #123

Closed AleCarminati closed 2 years ago

AleCarminati commented 2 years ago

I corrected the function proposal_update_allocations() in the implementation of the Split&Merge algorithm: in the last iteration of the for loop the iterator next_it was pointing to the element after the end_it, causing, in some cases, a segmentation fault. Following the suggestion of @mberaha, I removed next_it and modified the if clause where it was used.