Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #193: Swap to num_elements from size #194

Merged
merged 2 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ 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.
- Added precalculation of vector sizes to the `primarycensored_cdf()` stan function, avoiding errors on some platforms due to narrowing conversions in aggregate initialisation.
- Added precalculation of vector sizes to the `primarycensored_cdf()` stan function, avoiding errors on some platforms due to narrowing conversions in aggregate initialisation.
- Changed `D` to be of type real in `pcens_model.stan` in order to support infinite `relative_obs_time`.
- Switched to using `num_elements()` over `size()` in all stan code to resolve compilation issues on some platforms as reported by @sbfnk.

# 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});
int n_params = size(params);
int n_primary_params = size(primary_params);
int n_params = num_elements(params);
int n_primary_params = num_elements(primary_params);
array[n_params + n_primary_params] real theta = append_array(params, primary_params);
array[4] int ids = {dist_id, primary_id, n_params, n_primary_params};

Expand Down
2 changes: 1 addition & 1 deletion inst/stan/functions/primarycensored_ode.stan
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ vector primarycensored_ode(real t, vector y, array[] real theta,
}
array[primary_params_len] real primary_params;
if (primary_params_len) {
int primary_loc = size(theta);
int primary_loc = num_elements(theta);
primary_params = theta[primary_loc - primary_params_len + 1:primary_loc];
}

Expand Down
Loading