Skip to content

Instantly share code, notes, and snippets.

@WardBrian
Last active September 15, 2026 23:10
Show Gist options
  • Select an option

  • Save WardBrian/39ccf3c1a6ab60d98aa549babc98d29a to your computer and use it in GitHub Desktop.

Select an option

Save WardBrian/39ccf3c1a6ab60d98aa549babc98d29a to your computer and use it in GitHub Desktop.
Stan 2.40 release notes
- Updated precompiled header logic to use newer clang features when available. (#1346)
- Updated standalone generated quantities to respect the chain ID. (#1347)
- Reduce dependencies on the Boost library headers. (#1348)
- Updated to Eigen 5.0.1. (#3271, #3338)
- Stan's vendored dependencies are now included with `-isystem` by default. (#3333)
- Added `integrate_1d_double_exponential` and `integrate_1d_gauss_kronrod`. (#3326)
- Added `laplace_latent_solve` and `laplace_latent_solve_tol` to return the posterior mean and Cholesky factor from the embedded Laplace approximation. (#3337, #3345)
- Added reshaping helpers for converting between matrices and arrays of Eigen vectors/row vectors. (#3312)
- RNGs now behave properly when given a size-0 input. (#3389)
- `softmax` and `log_softmax` now support `row_vector` and arrays of either. (#3313)
- Added missing checks to a few unconstraining functions used by initialization. (#3387)
- Updated `student_t_qf` to only returns column eigen vectors. (#3317)
- Fixed an issue with `reduce_sum` to allow it to take in tuples and tuples of tuples. (#3376)
- Fixed an issue with rep_matrix sometimes returning a row-major matrix. (#3342)
- Fixed `bernoulli_logit_lpmf` and `bernoulli_logit_glm_lpdf` upper-tail gradients. (#3397)
- Fixed an incorrect derivative of `wiener_lpdf` with respect to the relative starting point parameter `w`. (#3324)
- Added `map`, `mapN`, `row_map`, `col_map`, `row_mapN`, and `col_mapN` functors for elementwise and rowwise/columnwise mapping over std::vector and Eigen matrices. (#3346)
- Fixed a bug in `ordered_logistic_lpmf` and `ordered_logistic_glm_lpmf` higher order autodiff. (#3327)
- `log_softmax` now returns empty vector on empty input. (#3328)
- Fixed missing `#include` for `finite_diff_hessian_auto` (#3354)
- Updated `normal_lccdf` and `std_normal_lccdf` to use `normal_lcdf` and `std_normal_lcdf` implementations. (#3363)
- Removed extra std::forward in fwd/functor/reduce_sum loop. (#3323)
- Used `std::nth_element` to reduce algorithmic complexity of `quantile` implementation, support using Eigen containers for multiple `p`. (#3358)
- Fixed typo in `tuple_to_laplace_options` forwarding function. (#3330)
- Fixed documentation signatures for laplace functions with built-in bernoulli_logit likelihood. (#3355)
- Fixed `make_holder(...)` with `var_value<Matrix>` output to now eagerly execute. (#3334)
- Added `const coeffRef()` definitions for the `Holder` class to resolve downstream compilation errors. (#3352)
- Updated the `.val()` member function to always returns a `CwiseUnaryOp` when called with a `var` type. (#3351)
- Efficiency: use multiplication over std::pow for squaring. (#3373) (#3375)
- Removed dependency on `boost/optional` and `boost/lexical_cast`. (#3378)
- Fixed `reduce_sum_static` to only evaluates inputs once. (#3384)
- Fixed an issue with forward-mode `jacobian` for mappings R^n -> R^m with m != n. (#3386)
- Fixed use-after-move in `cholesky_decompose` and `columns_dot_product`. (#3390)
- Fixed standalone generated quantities not respecting the chain ID for rng seeding. (#3402)
- Added `max_tries` as an argument to `stan::services::util::initialize`. (#3395)
- Fixed the output format of standalone generated quantities differing between the single- and multi-chain overloads. (#3404)
- Switched to using explicitly sized integer types in the structured_writer interface. (#3406)
- Fixed several edge case issues in the summary and analysis functions. (#3423)
- Reduce dependencies on the Boost library headers. (#3409, #3410, #3411, #3415, #3419)
- JSON writers are now flushed whenever the json object is finished, rather than at the end of the program. (#3418)
- Fixed some edge cases in JSON file writing. (#3427)
- Fixed an infinite loop when reading certain invalid CSV files. (#3428)
- The same `.stanfunctions` file can be included multiple times, with later times being ignored. This is particularly useful when `.stanfunctions` files include other `.stanfunctions` files. (#1639)
- Added `student_t_qf`. (#1620)
- Added the `poisson_binomial` distribution. (#1690)
- Added new variadic functions `integrate_1d_gauss_kronrod`, `integrate_1d_gauss_kronrod_tol`, `integrate_1d_double_exponential`, `integrate_1d_double_exponential_tol`. (#1626)
- Added new overloads to `softmax` and `log_softmax`. In addition to vectors, they now accept row vectors, arraws of vectors, and arrays of row vectors. (#1629)
- Support row-vector and vector inputs for `x` in `normal_id_glm_lpdf`. (#1698)
- Added `laplace_latent_solve(_tol)`, which return `tuple(vector, matrix)` (posterior mean and Cholesky factor). (#1649)
- Added `to_vector_array(matrix)`, `to_row_vector_array(matrix)`, and new overloads for `to_matrix`. (#1693)
- Updated the parser to reject invalid function definitions earlier, allowing for nicer error messages in some cases. (#1630)
- Improved the error message for using an unnormalized function in an invalid context. (#1636)
- Improved error messages for when a variable has a size which depends on an illegal expression. (#1647)
- Improved startup time of the compiler by deferring loading of the math library signatures. (#1623)
- Improved handling of some edge cases when the same variable is used on both left- and right- hand side of an assignment. (#1627)
- The Stan compiler is now built with OCaml 5.5.0 by default. (#1631)
- Formated .mll and .mly files with menhirformat. (#1634)
- Update ocamlformat to 0.29.0. (#1653)
- Added debug flag `--debug-print-factor-graph` to print the compiler's conservative over-approximation of the factor graph for the model(s) implemented in the Stan program. (#1673)
- Reduced dependencies by leveraging new OCaml features. (#1644, #1650, #1651,
#1652, #1655, #1656, #1661, #1665, #1676)
- Update ICE handling with new Format functions. (#1645)
- Added a new vectorize_loops optimization (enabled at `--Oexperimental`).
(#1666, #1672, #1683)
- Optimized map operations in dataflow analyses. (#1682)
- Optimized the partial evaluated by avoiding a re-typecheck of unchanged functions. (#1700)
- Fixed the inferred type of multi-indexed expressions in the compiler's middle intermediate representation. (#1667)
- Fixed an issue where compiler optimizations could treat unreachable code as valid and generate problematic results. (#1687)
- Fixed an incorrect optimization which could rewrite the categorical distribution in incorrect situations. (#1689)
- Fixed an issue where `--name` could be used to generated invalid C++. (#1701)
- Fixed an issue with `--Oexperimental` which would change the meaning of for loops with unusual expressions in their lower bound. (#1702)
- Fixed several issues where `--Oexperimental` would generate invalid C++. (#1712, #1713, #1715, #1716, #1717)
- Improved code-generation of local variable dimensions. (#1691)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment