Skip to content

Commit

Permalink
Fix sizing bug in set_summary_fun_cpp that causes res to be too large…
Browse files Browse the repository at this point in the history
… when the summary fun output was smaller than dat
  • Loading branch information
apulsipher committed Nov 19, 2024
1 parent bf4b679 commit 29f14d0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lfmcmc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,12 @@ SEXP set_summary_fun_cpp(
LFMCMC<TData_default>*
) -> void {

if (res.size() == 0u)
res.resize(dat.size());

auto dat_int = cpp11::integers(dat);
auto res_tmp = cpp11::integers(fun(dat_int));

if (res.size() == 0u)
res.resize(res_tmp.size());

std::copy(res_tmp.begin(), res_tmp.end(), res.begin());

return;
Expand Down

0 comments on commit 29f14d0

Please sign in to comment.