Skip to content

promote int[] to real[] as argument for every function #830

@bob-carpenter

Description

@bob-carpenter

Make sure that all functions and distributions specifying real[] arguments also accept int[] arguments.

This should only be done where there is not a specialization for integers. mean(), for example, only has the signature (rea[]):real, and the promotion would allow signature (int[]):real --- the result is the same type because means of integers can be real. Similarly for the Dirichlet density dirichlet_log of signature (real[], real[]): real, which would accept int[] arguments (though only the size-1 int[] argument is an appropriate simplex for the first argument).

  • Create a list of functions by scanning the manual index (I'm looking at stan-functions-2.13.0.txt)
    • cov_exp_quad;(real[] x, real sigma, real l);matrix;438
    • cov_exp_quad;(real[] x1, real[] x2 real sigma, real l);matrix;438
    • cumulative_sum;(real[] x);real[];437
    • integrate_ode;(function ode, real[] initial_state, real initial_time, real[] times, real[] theta, real[] x_r, int[] x_i);real[\nobreakspace ,\nobreakspace ];450
    • integrate_ode_bdf;(function ode, real[] initial_state, real initial_time, real[] times, real[] theta, real[] x_r, int[] x_i);real[];450
    • integrate_ode_bdf;(function ode, real[] initial_state, real initial_time, real[] times, real[] theta, real[] x_r, int[] x_i, real rel_tol, real abs_tol, int max_num_steps);real[];450
    • integrate_ode_rk45;(function ode, real[] initial_state, real initial_time, real[] times, real[] theta, real[] x_r, int[] x_i);real[\nobreakspace ,\nobreakspace ];450
    • integrate_ode_rk45;(function ode, real[] initial_state, real initial_time, real[] times, real[] theta, real[] x_r, int[] x_i, real rel_tol, real abs_tol, int max_num_steps);real[\nobreakspace ,\nobreakspace ];450
  • doc each new signature
  • test each new signature on its own and with an example model instantiating it (mostly in transformed data other than for rngs)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions