diff --git a/NEWS.md b/NEWS.md index f93058a..b51d9df 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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 diff --git a/inst/stan/functions/primarycensored.stan b/inst/stan/functions/primarycensored.stan index 30447f8..37e3e77 100644 --- a/inst/stan/functions/primarycensored.stan +++ b/inst/stan/functions/primarycensored.stan @@ -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}; diff --git a/inst/stan/functions/primarycensored_ode.stan b/inst/stan/functions/primarycensored_ode.stan index 1df06a2..b2adf94 100644 --- a/inst/stan/functions/primarycensored_ode.stan +++ b/inst/stan/functions/primarycensored_ode.stan @@ -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]; }