Skip to content

v2.0.0

Compare
Choose a tag to compare
@github-actions github-actions released this 03 May 16:15
· 111 commits to main since this release

BridgeStan 2.0.0

This version of BridgeStan features several breaking changes, primarily to the C API which is used "under the hood", but also to how models with generated quantities must be called. Additionally, many "quality of life" features have been added, ranging from const correctness in the C API, to vastly improved error messages in the interfaces.

The BridgeStan documentation has been updated, and old versions of the docs are now available via a dropdown at the top of each page.

Interface changes

Breaking Changes

  • For all interfaces, the param_constrain family of functions now accept an rng argument of type StanRNG. This is required if include_gq is set in the function, otherwise it may be omitted. These RNGs are now used in any RNG function calls inside the generated quantities block, rather than using an RNG stored inside the BridgeStan model object.
  • This means that the param_constrain function is now thread-safe if each thread has its own StanRNG. See the documentation for your preferred interface for more on how to instantiate StanRNGs.

Other Changes

  • BridgeStan has updated to Stan 2.32.1
  • Error messages are now properly reported by each language's preferred exception mechanism. This means no more "See C++ stderr for details" messages when an error occurs.
  • All interfaces: print() statements inside of Stan models will now be directed to stdout instead of stderr.
  • Python: print() statements inside of Stan models are re-directed to sys.stdout by default to allow them to appear in things like Jupyter notebooks. See the capture_stan_prints argument to the StanModel constructor for more details.

C API

Breaking Changes

  • Mirroring the above changes for param_constrain, the bs_model_rng type has been split into two types, bs_model and bs_rng. The creation and destruction functions have been renamed to bs_model_construct/bs_rng_construct and bs_model_destruct/bs_rng_desctruct.
  • The param_constrain function accepts a new bs_rng* argument, which can be NULL if include_gq is false.
  • Any function in the C API which can fail (those which return integer return codes) now accept an additional argument of type char **. If a non-null pointer is provided, it will be set to a newly allocated error message string if a failure occurs. Error messages are no longer printed to stderr. These strings must later be freed by calling a new function bs_free_error_msg.

Other Changes

  • The C API functions now properly mark bs_model* arguments as const where appropriate. With the param_constrain changes, this means all functions except for bs_model_destruct take a const pointer now.
  • Three new constants are available in the C API - bs_major_version, bs_minor_version, bs_patch_version.
  • The data argument to the bs_model_construct function can now be NULL, indicating "no data".
  • A new function, bs_set_print_callback is available. This can be used to provide a function which is called when print statements in the Stan model are run. This is primarily used in the Python interface to re-direct to sys.stdout.
  • The C API now uses the stdbool.h header file's bool type, rather than typedef int bool

Full Changelog: v1.0.2...v2.0.0