Skip to content

Commit

Permalink
177: use num_elements instead of size (epinowcast#178)
Browse files Browse the repository at this point in the history
* use `num_elements` instead of `size`

* add news item
  • Loading branch information
sbfnk authored Dec 11, 2024
1 parent 2c1e8c8 commit 2cfa802
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Development release.
## Bug fixes

- Added a missing `@family` tag to the `pcens` functions. This omission resulted in the Weibull analytical solution not being visible in the package documentation.
- Changed a call to `size()` to use `num_elements()` instead as an underlying type conversion was causing issues on some platforms.

# primarycensored 1.0.0

Expand Down
4 changes: 2 additions & 2 deletions inst/stan/functions/primarycensored.stan
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ real primarycensored_cdf(data real d, int dist_id, array[] real params,
} else {
// Use numerical integration for other cases
real lower_bound = max({d - pwindow, 1e-6});
array[size(params) + size(primary_params)] real theta = append_array(params, primary_params);
array[4] int ids = {dist_id, primary_id, size(params), size(primary_params)};
array[num_elements(params) + num_elements(primary_params)] real theta = append_array(params, primary_params);
array[4] int ids = {dist_id, primary_id, num_elements(params), num_elements(primary_params)};

vector[1] y0 = rep_vector(0.0, 1);
result = ode_rk45(primarycensored_ode, y0, lower_bound, {d}, theta, {d, pwindow}, ids)[1, 1];
Expand Down

0 comments on commit 2cfa802

Please sign in to comment.