STANC3 RELEASE NOTES ====================================================================== v2.39.0 (19 May 2026) ====================================================================== - The embedded Laplace functions are now available. (#1586, #1599) - Length-1 tuples can now be declared using a trailing comma, e.g. `tuple(real, ) x = (3.14, );`. This is primarily valuable for using tuples with the embedded laplace approximation feature, which uses tuples to pass arguments to user-defined callbacks. (#1609) - Functions ending in `_jacobian` will always be treated as needing access to the jacobian adjustment, and thus will only be usable in `transformed parameters` and other `_jacobian` functions. (#1584) - Added the `yule_simon` distribution: `yule_simon_lpmf`, `yule_simon_lcdf`, `yule_simon_lccdf`, `yule_simon_cdf`, and `yule_simon_rng`. (#1607) - Improved the uninitialized variable warnings raised by pedantic mode and `--warn-uninitialized`. (#1579) - `--debug-generate-data` is now aware of the new `sum_to_zero_vector`, `sum_to_zero_matrix`, `stochastic_row_matrix`, and `stochastic_column_matrix` types. (#1588) - Added missing overloads to the `upper_lower` and `offset_multiplier` constraint functions. (#1589) - Improved error message wording and location information. (#1585, #1580, #1587, #1604, #1605, #1608, #1611) - Various optimization bug fixes. (#1598, #1600, #1602) - stancjs: Use js_of_ocaml-ppx for type safety. (#1613) - Fixed a bug in the parser that could lead to crashes when auto-formatting files with many `#includes`. (#1615) v2.38.0 (13 January 2026) ====================================================================== - Improved formatting and wording of compiler warnings and error messages. These can display in color when the output is a supporting terminal. This can be overriden with `--color=never` or `$STANC_COLORS` set to `never`. (#1548, #1551, #1546, #1549, #1550, #1552, #1561, #1560) - Expiring deprecation: `jacobian` is now a reserved keyword. (#1573) - Added new functions: wiener_lcdf_defective and wiener_lccdf_defective for use with the wiener distribution. (#1576) - Added new overloads to the 5/8 argument wiener_lpdf functions with an additional data real argument to control the precision of the gradient. (#1576) - Command line flags like `--use-opencl` can be passed multiple times once more. This is equivalent to passing them exactly once, and is only provided for backwards compatibility with existing code that may not properly prepare the arguments to the compiler. (#1541) - `--debug-mem-patterns` will now output information about why each variable was not considered a candidate for the SoA optimization. (#1566) - Autocomplete scripts (for bash, zsh, and powershell) and manpages are now available for the stanc compiler. (#1572, #1558) - Fixed a pedantic warning referring to a now-incorrect location in the user's guide. (#1567) - All warnings from pedantic mode will now have a location associated with them. (#1568) - The C++ generated by models with many individually named parameters should be less likely to produce errors complaining about `bracket depth exceeded`. (#1542) - Improved code generation of user-defined functions accepting tuples to resolve some C++ compilation errors. (#1556) - Fixed an issue where some function names like `min` could lead to conflicts with the C++ standard library if they were overloaded by a user. (#1557) - Generated C++ now always encodes when we expect integers to become doubles. (#1577) - Updated C++ templating around autodiff scalars. (#1555) - Fixed the some of the newer constraint types not having sufficient size checks for their declarations in the generated C++. (#1563) - Fixed a compiler crash that could be triggered by certain nested `#include` statements. (#1564) - Improved the formatting of long functions (either with long names or many arguments). (#1562) - stanc.js can request ANSI escape code styling in errors and warnings by passing `color-output` as an argument. These are supported in most browser consoles. (#1569) - Removed unused code from Common. (#1538) - Cleaned up pretty-printer code. (#1527) - Reduced cross-module access to mutable state. (#1543) - Encapsulated local exception usage. (#1544) - Statically forbid promotion nodes in the untyped AST. (#1545) - Fixed inconsistency in whether locations are opaque in sexps. (#1547) - stanc3js will no longer try to load node modules at startup. (#1553) - `dune build @install` no longer adds stanc's testing executables to the `bin` folder. (#1571) - Cleaned up dune-project file. (#1574) - Updated `ocamlformat` to 0.28 (#1570) - Updated Fmt to 0.11.0 (#1537) v2.37.0 (2 September 2025) ====================================================================== - Added a new constraint, `sum_to_zero_matrix`, which is a matrix that sums to zero along both axes. (#1506) - Exposed the `hypergeometric_1F0`, `hypergeometric_2F1`, `hypergeometric_3F2`, and `hypergeometric_pFq` functions (#1504) - All the built-in constraint types now have corresponding `_jacobian`, `_constrain`, and `_unconstrain` functions. The first two functions are identical except for the _jacobian version will increment the target with the necessary change of variables adjustment. (#1494) - Improved the command-line argument parser for `stanc`. Existing flags are still supported, but new aliases may be available. See the new and improved `stanc --help` for details. (#1478) - The compiler now accepts `-` as a model argument, in which case it reads from standard input. (#1488) - Decreased the start-up overhead of the compiler. (#1496, #1498) - Fixed a bug with assigning to an entire vector or matrix using `:` with the `--O1` flag. (#1508) - Fixed a few functions being labeled as supporting the struct-of-arrays matrix type when they in fact did not. (#1540) - Updated code generation of tuples to avoid issues with dangling references and some generated code being uncompilable. (#1535) - The MacOS binaries we distribute are now 'universal' (fat) binaries, and therefore will not require Rosetta to run. (#1483, #1501) - Updated our build process to make it easier to maintain. Note: Stan is no longer building binaries for the mips64le architecture. (#1495) - Removed usages of the `re` library (#1489) - `stanc.js` will now properly complain if it is supplied with incorrect javascript types for its arguments. (#1475) - `stanc.js` and `stanc.exe` now share significantly more code between them. (#1477) - Fixed an issue where repeated calls to `stanc.js` would re-use the same model namespace in the generated C++ (#1492) - Updated `js_of_ocaml` version to 5.9.1 (#1484) - Updated `fmt` version to 0.10.0 (#1512) v2.36.0 (10 December 2024) ====================================================================== - Removed code following the last round of syntax deprecations that is currently scheduled. The final one (use of `real` values in conditionals) is now a type error and can no longer be automatically canonicalized. (#1420) - Added the `jacobian +=` statement, an analogue of `target +=` but which can be conditionally disabled by Stan's algorithms when a unadjusted estimate is required. (#1435, #1437, #1471) - Added `stochastic_row_matrix` and `stochastic_column_matrix` transforms for matrix types. (#1442) - Added the `sum_to_zero_vector` transform for vector types. (#1443) - Added distribution: beta_neg_binomial, with corresponding lpdf, cdf, lcdf, lccdf, and rng functions. (#1452, #1459, #1467) - Added all-vector signatures to the newer versions of `wiener_lpdf`. (#1451) - `stanc.js` can now accept models which contain `#include` statements. A fourth argument is available on the javascript stanc function which must be either `undefined` or a object mapping included file names to Stan source code as strings. (#1433) - Enabled OpenCL support for the `binomial_logit` and `binomial_logit_glm` distributions. (#1368) - Fixed an issue where certain overloads of distributions could lead to the `~` statement producing uncompilable C++. (#1466, #1474) - Fixed an issue where `operator/` was not generating the correct C++ for complex linear algebra types. (#1421) - Fixed an issue where certain variable names would end up conflicting with system-specific macros in the generated C++. (#1429) - Fixed an issue where void functions were not given the same checks as returning functions, leading to uncompilable C++ in some cases. (#1471) - Updated parameter code generation to use `auto` so that the parameter types for matrices can be Eigen maps. (#1441) - Rolled back js_of_ocaml to 5.4.0 for compatibility with QuickJS. (#1427) - Added builds of `stanc.js` with pretty-printing and debug info. (#1440) v2.35.0 (3 June 2024) ====================================================================== - Rename `sampling statement (~)` to `distribution statement (~)` to be consistent with the docs changes. (#1426) - The generated C++ no longer assumes that the RNG used in Stan is specifically the `boost::ecuyer1988` generator, but uses a type alias defined in the Stan library. (#1395) - Fixed an issue where multiple `reject` statements could cause the C++ compiler to fail. (#1396) - Giving a variable the name `jacobian` is now deprecated. This name is being reserved for future language extensions. (#1397) - When encountering an unknown identifier that matches a known suffixed function without its suffix, add the known function name to the error message. (#1401) - Added `fatal_error()`, which is similar to `reject()` but rather than signaling an error which is recoverable, signals an error which should terminate execution immediately. `fatal_error` is now a reserved word. (#1402) - Exposed the new overloads of `wiener_lpdf` added to Stan Math by @Franzi2114. (#1411) - Added a better error message when a program attempts to use the removed array syntax. (#1413) - Use tabs to position error message cursor when appropriate. (#1414) - Replaced the link show when the deprecated `lkj_cov` distribution is used with the new link (see https://github.com/stan-dev/docs/pull/694). (#1415) - The compiler should display a cleaner error if it encounters an internal error. (#1416) - Clarified the error messages generated by a syntax error on the right side of an assignment statement. (#1417) - Removed code following the last round of syntax deprecations that is currently scheduled. The final one (use of `real` values in conditionals) is now a type error and can no longer be automatically canonicalized. (#1420) - Fixed an issue where `operator/` was not generating the correct C++ for complex linear algebra types. (#1421) - Rollback js_of_ocaml to 5.4.0 for compatibility with QuickJS. (#1427) v2.34.0 (16 January 2024) ====================================================================== - Added the `binomial_logit_glm` distribution (#1367) - Added the `dirichlet_multinomial` distribution. (#1389) - Added the ability to unpack a tuple during an assignment. For example, the following is now valid: ```stan parameters { matrix[N, M] A; } model { matrix[N, M] Q; matrix[M, M] R; (Q, R) = qr_thin(A); // qr_thin returns a tuple(matrix, matrix) } ``` (#1360) - Exposed vectorized signatures for the `atan2` function. (#1364) - The Stan compiler will now warn you when you reassign a variable to itself. (#1358) - Updated the OCaml-to-JS compiler used to create stanc.js (#1365, #1381) - Updated the compiler to use OCaml 4.14 and newer versions of its dependencies. (#1366) - Reverted a change to SoA initialization, as the Math library has implemented a better fix. (#1376) - Fixed an issue with clang compilers and constructing tuples. (#1382) - The compiler no longer recognizes language constructs removed in 2.33. (#1388) - The deprecated implicit conversion of reals to boolean conditions has been removed. (#1388) v2.33.1 (13 September 2023) ====================================================================== - Fixed several issues with the code generation of user-defined functions which accepted tuples (#1356) v2.33.0 (5 September 2023) ====================================================================== - Added tuple types to the language (#1100) - The following deprecations have been turned into errors this version: - The old array syntax, e.g. `int arr[5];`. Use `array[5] int arr;` instead. - Distribution functions ending in `_log`. Use either `_lpdf` or `_lpmf`. - The functions `binomial_coefficient_log`, `multiply_log`, and `cov_exp_quad`. Use `lchoose`, `lmultiply`, and `gp_exp_quad_cov` respectively. - The `if_else` function. Use the ternary operator `cond ? true_value : false_value` - Use of CDFs with a `,` between the first and second argument. Use a `|`. - Comments beginning with `#`. Use `//`. - Use of `<-` for assignment. Use `=`. - The `increment_log_prob` function. Use the `target +=` statement. - The `get_lp()` function. Use `target()`. - The use of nested multi-indices on the left hand side of an assignment statement. For this version, these can all be automatically updated with the `--canonicalize=deprecations` argument to the autoformatter. This is not guaranteed to work for versions _following_ this one. Additionally, the following identifiers are now reserved words: `array`, `offset`, `multiplier`, `lower`, and `upper`. (#1287) - Exposed vectorized signatures for `log_sum_exp` (#1344) - Exposed new functions `qr`, `qr_thin`, `eigendecompose_sym`, `eigendecompose`, `complex_schur_decompose`, `svd`, and `csr_extract`. (#1346) - Added a `log_prob_impl` specialization specifically for reverse mode to improve code generation (#1327) - Fixed an issue where returning array literals could produce the wrong types in C++. (#1335) - Fixed an issue with leading zeroes in real literals like `0E0` (#1336) - Fixed a bug with type promotion in the arguments to user-defined distributions generating bad C++. (#1338) - Fixed optimization logic for deducing whether mixes of scalars, data matrices, and autodiff matrices can be promoted to SoA (#1347) - Fixed an issue with the partial evaluator crashing on statements containing a mod-by-zero. (#1351) - `--filename-in-msg` now also affects the name of the file shown in runtime exceptions. Useful for interfaces which use mangled or temporary names during compilation. (#1339) - Improved error message provided when the wrong return type is returned from a function. Return statements now follow the same type promotion rules as assignment and function argument passing. The typechecker now allows infinite loops (`while (1)` without an internal `break`) to be the end of a returning function. Previously, an (unreachable) return statement was needed following the loop. (#1341) - Improved error messages for unsupported type in reduce_sum (#1332) - Improved error messages when using a reserved word as a variable name. (#1343) v2.32.1 (2 May 2023) ====================================================================== - The shapes and sizes of parameter initial values are now checked against the specified sizes in the model before being read in, matching the existing behavior for data. (#1316) **Note:** This change may cause existing code which worked "by accident" to raise new errors about mismatches between the model's declarations and the provided initialization. - Errors in transform_inits should now properly highlight the location in the original Stan program. (#1318) - Fixed an issue where the `--debug-generate-inits` debug flag would fail badly if parameter sizes depended on data (#1319) v2.32.0 (20 April 2023) ====================================================================== - Syntax removals scheduled for this version have been pushed back to 2.33. We still recommend updating your Stan models as you are able. As a reminder, deprecated syntax which will be removed in minor versions can as a rule be updated automatically using find-and-replace tools or the [Stan compiler's auto-formatting abilities](https://mc-stan.org/docs/stan-users-guide/stanc-pretty-printing.html). (#1303) - The deprecated `--include_paths` and `--allow_undefined` arguments have been removed, use `--include-paths` and `--allow-undefined`. (#1303) - Recursive user-defined functions no longer need forward declarations. (#1277) - Added overloads to `eigenvalues` and `eigenvectors` which accept a complex matrix as input. (#1282) - Fixed an issue where `profile` blocks could generate uncompilable C++ when used with `--O1`. (#1281) - Fixed an issue where the compiler would generate uncompilable C++ when a matrix expression featured mixed types of elements. (#1292) - Fixed an issue where a user-defined-function expecting real arguments could be passed an integer and exhibit integer behavior like truncating division. (#1296) - Fixed an issue where external functions could not be used in higher-order functions without the end-user supplying an implementation of our functor structs. (#1298) - Fixed a bug in `transform_inits` for models which used complex types (#1305) - Improved the error shown when an `#include`d file cannot be found to list the paths it searched on. (#1273) - Improved `--filename-in-msg` for the command line version of `stanc`. Errors now use the requested name, not just warnings. (#1274) - Refactored how C++ is code-generated in the compiler. (#1233) - Added tests for various parts of the C++ backend which weren't previously tested, and added a `--debug-lir` flag to print out the C++ representation in a s-expression. (#1276) - Updated code generate of `get_param_names` (#1245) - Switched to `std::endl` instead of `'\n'` to end prints. (#1301) - Added a new function `unconstrain_array` to the generated code. This is currently not exposed. (#1305) - Added a `--debug-generate-inits` flag to stanc which behaves like `--debug-generate-data` but for declarations in the `parameters` block. (#1306) - Sped up some code which is critical to parsing. (#1302) v2.31.0 (21 November 2022) ====================================================================== - Improved the error message for bad multiple declarations. (#1239) - Fixed a bug where using a C++ reserved word as a name in certain situations would prevent compilation. (#1243) - Build binaries in parallel on Jenkins. (#1244) - Added functions `complex_schur_decompose_t()` and `complex_schur_decompose_u()` implementing the complex-valued Schur decomposition for matrices.(#1247) - Vectorized the `conj` function for complex types.(#1253) - CI change, build backwards-compatible Mac executables on flatiron mac. (#1255) - Improved the error generated when a function is re-declared, or when a function is not given a definition. (#1256) - `print` and `reject` will now be listed as functions in `stanc --info`s output. (#1257) - Added quantile functions (inverse-CDFs) `std_normal_qf` and `std_normal_log_qf`. `std_normal_qf` is a synonym for `inv_Phi`, and `std_normal_log_qf` is the same but with the input on the log-scale.(#1258) - Fix using `reject()` with container types. (#1261) - Vectorized sampling statements can now be used with the truncation syntax `T[ , ]`(#1263) - Functions which return integer types are considered as "data" for purposes of data-only arguments.(#1265) - The negation operator `-` can now accept arrays, e.g. `array[N] int foo = {...}; print(-foo);`(#1266) - Exposes algebraic functions with a variadic arguments, using the following four functions: `solve_powell`, `solve_powell_tol`, `solve_newton` and `solve_newton_tol`. Relevant changes to Stan-math are already merged.(#1268) v2.30.1 (27 July 2022) ====================================================================== - Improved the pedantic mode warning for parameters without priors. The message now highlights when it is safe to ignore it. - Fixed a bug in the memory pattern optimization where a for loop generated for the function inliner would prevent detection of for loops higher in the control flow graph. - Fixed an issue with the function inliner when a function local variable had the same name as a variable in the calling scope. - Fixed an issue where recursive functions which called themselves with a slice of their arguments would lead to infinite template expansion in C++ compilation. - Fixed a bug in stanc.js where the stanc flags were not listed correctly in the generated C++. - The imaginary components of complex vectors and matrices are now initialized to NaN to match the real component and behaviour of non-complex vectors and matrices. v2.30.0 (1 July 2022) ====================================================================== Complex: - Added complex containers: `complex_matrix`, `complex_vector`, and `complex_row_vector` with basic arithmetic support. (#1133) - Fixed indexing of a complex container to return the correct type. (#1158) - Added many common linear algebra functions and container operations for complex types. (#1166) - Fixed an issue reading in `complex_matrix` in the data block. (#1168) - Added vectorized signatures for `get_real` and `get_imag`, e.g. `get_real(complex_matrix) => matrix`. (#1169) - Added `fft`, `inv_fft`, `fft2`, and `inv_fft2` to the language. (#1170) - `pow` (and subsequently the `^` operator) now have overloads for complex containers. (#1186) - `to_complex` is now vectorized. This means signatures like `to_complex(matrix, matrix) => complex_matrix` are now available. (#1208) - Added signatures for addition, subtraction and division which mix scalars and complex vector types, broadcasting the scalar as appropriate. (#1212) - Added `svd_U`, `svd_V`, `singular_values`, `eigenvalues_sym`, and `eigenvectors_sym` for complex inputs. (#1212) New functions: - Added `L1` and `L2` norms. (#1140) - Added `log_determinant_spd` which is faster when the input matrix is known to be symmetric and positive definite. (#1178) - Added `wishart_cholesky_lpdf` and `wishart_cholesky_rng` distribution functions. (#1188) - Added `multi_student_t_cholesky_lpdf` and `multi_student_t_cholesky_rng` distribution functions. (#1197) - Added `inv_wishart_cholesky_lpdf` and `inv_wishart_cholesky_rng` distribution functions. (#1202) - Exposes inv_inc_beta. (#1211) Misc: - Re-enabled function inlining optimizations at O1. (#1097) - Modified the optimizer to turn statements like `3 + 4i` into `to_complex(3,4)` directly. (#1112) - Added `cumulative_sum(Vector/RowVector)` for `var` types. (#1152) - Improved compile times by accumulating all template requirements into a single `require_all_t` on user defined functions. (#1157) - The `--info` and `--debug-generate-data` commands now use the Yojson library for it's output. (#1161, #1175) - Bugfixed for output values in `write_array` that should be `NaN`. (#1165) - `--dump-stan-math-signatures` now prints an entire signature on one line, no matter how long it is. (#1167) - Fix --debug-generate-data for ordered vector data types. (#1173) - Exposed an overload for `cumulative_sum` which takes and returns an array of integers. (#1174) - The javascript interface (stancjs) now generates errors which look more like stanc3's by pointing out where in the supplied code the error occurred. (#1177) - Cleaned up the internal structuring of modules in the compiler. (#1179) - Cleaned up code for pretty printing the Middle Intermediate Representation (MIR). (#1180) - Added `--debug-mem-patterns` flag, which will print out the memory type of variables (either Array of Structs or the more efficient Struct of Arrays pattern) when optimization is enabled. (#1185) - Allowed the adding of new distributions without requiring them to support deprecated suffixes. (#1191) - Added `eigenvectors` and `eigenvalues` functions which return the complex-valued eigenvectors or eigenvalues of a real (asymmetrix) matrix. (#1192) - `abs` is now vectorized for container types. `fabs` is now deprecated, as all usages can be replaced with `abs` thanks to array promotion rules. (#1195) - Made installing the developer tools for the Stanc repository an interactive script with error handling. (#1200) - Internally clean up how variable declarations are represented. (#1203) - Simplified internal representations in the compiler. (#1204) - The pretty-printer now preserves multiple declarations in one line like `int a, b;` rather than splitting them into two declarations. (#1207) - Declarations are now allowed in places they previously would not parse, such as the only statement in the body of an if statement. (#1207) - `./`, `/` `.*`, and `*` now have consistent behavior with scalar arguments. (#1209) v2.29.2 (25 March 2022) ====================================================================== - Fixed a bug fix with `--O1` when arrays declared in transformed parameters or model were assigned data. - Added missing signatures for `normal_id_glm_lpdf`. - Fixed a compilation error with forward declarations. - Disabled AD level optimizations in `--O1` optimizations. - MIR pretty printing now always adds ( and ) around the ternary operator ?: v2.29.1 (2 March 2022) ====================================================================== - Formatting without a | when only one argument is supplied to a distribution. - Stanc previously would allow you to erroneously assign a function to a different functions name using =, which then failed in C++ compilation. This is now an error. - Nonlinear transforms of the LHS of a tilde statement now produce warnings in pedantic mode. - Improved type error messages for operators and tilde statements. v2.29.0 (14 February 2022) ====================================================================== FEATURES - Allow most reserved words in C++ (e.g., `public`) to appear in a stan program; they will be changed by the compiler to `_stan_` in the generated C++. (#962) - User defined functions can now be overloaded. Multiple definitions of the same function name are allowed if the arguments are different in each definition.(#1027) - Improved error messages for incorrect variable declarations. (#1099) - When an unknown identifier is encountered Stan will suggest nearby known names you might have meant (#1024) - Extra semicolons in `data` or `parameters` no longer produce syntax errors. (#988) - Improved error messages for incomplete probability library calls. (#1021) - Added nicer error message when a comment is unterminated at end of input. (#1025) - All internal compiler errors now include a link to the stanc3 issues page. (#1028) - Improve error messages when a user tries to declare a function argument as a constrained type. (#1030) - Replaced the use of the word twiddle with tilde in pedantic warning messages. (#1050) - Allow user-defined densities over complex arguments and deeply nested arguments. (#1046) - Added optimization layers `--O0` (default), `--O1`, and `--Oexperimental` - Turn back on allowing immediately assigned to decls not be NaN initialized at `O1` (#1029) - Allows `log_prob_impl` to use Struct of Arrays type for reverse mode autodiff at `O1` (#955) - Issue a warning when a user has a model with unreachable statements, such as code following a `return` statement. (#1063) - The compiler can now compile or format standalone function definitions in a `.stanfunctions` file. These are compiled as if a normal Stan program was compiled with `stanc3 --standalone-functions` and can be used with `#include` statements in the `functions` block (#1022) - The canonicalizer can now have each part enabled seperately. This can be done with commands like `stanc --auto-format --canonicalize=braces,deprecations `. Current options are `deprecations`, `braces`, and `parenthesis`. (#1058) - Ensure the canonicalizer properly prints nested if-else statements. (#1055) - `--auto-format` no longer prints code which originated from an `#include` directive. This can be re-enabled by using `canonicalize=includes`. (#1069) - When using `--auto-format`, the user can now pass `--max-line-length=#` to set the column number at which the formatter will try to break lines. (#1068) - Tweak pretty-printing of if-else blocks. (#1008) - Canonicalizer now adds brackets around single statements in if-else/for/while. (#1003) - Expose `bernoulli_logit_glm_rng` functions. (#1034) - lchoose now has the same signatures as binomial_coefficient_log. (#1010) - Added `ordered_probit_lpmf(array[] int, real, vector) => real` and `ordered_probit_lpmf(array[] int, real, array[] vector) => real`. (#1073) - Added additional `normal_id_glm` signatures. (#1084) - Added signatures for `inv_erfc` function. (#1090) - Added Differential-Algebraic Equation solver (`dae`, `dae_tol`). (#1092) - Added `von_mises_cdf`, `von_mises_lcdf`, von_mises_lccdf`. (#1085) - Added `loglogistic_lpdf`, `loglogistic_log`, `loglogistic_rng` and `loglogistic_cdf`. (#1094) - Clean up more mutable state in the Javascript interface (#1118) DEPRECATIONS - Added a warning for `matrix^scalar` that points users to `.^` and `matrix_power()`. (#1026) - Warn about the following identifiers being reserved in a future version: `array`, `upper`, `lower`, `offset`, `multiplier`. (#1048) - The old form of declaring arrays like `real a[5]`, which has been deprecated since 2.26, now issues a warning. (#1072) - Marked existing syntax deprecations (e.g., `<-`) as expiring in Stan 2.32.0. (#1044) - Deprecate nested multi-indexing on lvalues as it is inconsistent with rvalues.(#1059) BUGFIXES - Fixed an issue that arose during C++ compilation of models that used a variable with the same name as a Stan library function and called that function. (#1011) - Fixed a bug where the lexer was allowing illegal variable names which began with an underscore. (#962) - Fixed an issue with parser errors 'sticking around' on subsequent runs, which primarily affected the Javascript compiler. (#1074) DEVELOPER - Updated OCaml and build dependencies. (#1019) - Create internal developer documentation at https://mc-stan.org/stanc3/stanc/. (#1006) - stan2tfp now lives in a seperate repo at stan-dev/stan2tfp. (#1040) - Refactored Stan typechecker. (#995) - Replaces all references to Docker Hub for andrjohns images with stanorg. (#1017) - Move docker to ci-scripts repository. (#1020) - Refactored when logic for binaries builds and release. (#1018) - Added optimization level flags, debug-* and dump-math-signatures flags to stancjs. (#1082) - Compile Tests and Model end-to-end tests run now optionally only when test/integration/good has changed. (#1018) v2.28.1 (21 October 2021) ====================================================================== - Expose missing arg() function - Turned off default of allow_uninitialized_decls - Fixed transform_inits input and output sizes Note: There are known issues during compilation when calling functions that expect complex arguments with variables of type `int` or `real`. If this is required, please wrap the arguments with a call to `to_complex()`. This will be addressed in the next release. v2.28.0 (5 October 2021) ====================================================================== - Int division is now handled by the Warnings module to print this to stderr and to avoid printing to stderr directly (a problem for stanc.js). (#869) - Correct canonicalizing/auto-formatting of commented Stan programs; comments no longer discarded. (#894) - Improved error messages when argument types don't match the function signature. (#907) - A warning is now produced if an empty file is compiled. (#919) - Stancjs now has `--info` and `--debug-generate-data` options.(#920) - Added support for `skew_double_exponential` distribution.(#921) - Reorganized warning system internally.(#922) - Removed initialization of NA values from objects that are immediately assigned to(#930) - Added `to_matrix(array[] row_vector) => matrix`. (#931) - Added build process for arm64, armhf, armel, mips64el, ppc64el and s390x linux architectures. (#936) - Implemented complex type functionality. (#940) - Added types used for deducing memory patterns. (#944) - Removes dune runtest from binary build stage. (#950) - Provide rough support for non-ASCII characters in string literals. (#952) - Clean up internal exception handling. (#957) - Added the ability to write imaginary numbers as literals, such as "3.1i". (#963) - Added a list of included files to the information provided by `--info`. (#965) - Tweaked pretty-printing of conditional distribution applications. (#967) - Better pretty-printing for long constraints. (#970) - Fix automated builds of non-x86 architectures. (#972) - Fixed a bug with the conditional operator `?` and the use of vector or matrix expressions. (#977) - Fixed a typo in the error message displayed when a file cannot be found. (#981) - Error messages should now always have a trailing newline. (#982) - Miscellaneous README.md improvements. (#914, #943, #984) v2.27.0 (2 June 2021) ====================================================================== - Added the `--info` argument to output a list of functions and distributions used.(#813) - Added `ode_ckrk` and `ode_ckrk_tol` to the Stan language.(#828) - Cleaned up indexing by using variadic rvalue and assign functions.(#829) - Fixed incorrect codegen for mixed-type array expressions.(#830) - Added building ARM to our infrastructure.(#832, #833) - Made locations_array constexpr and moved curr_statement__ to function scope.(#842, #845) - Added range checks.(#849, #521) - Consolidated the use of | in cdf functions to match lpdf/lpmf and lccdf functions. Comma version of cdf function is deprecated.(#863) - Adds signatures for data-only quantile functions.(#870) - Cleanup readability of the C++.(#871) - Adds vectorized versions of `fma()`.(#888) - Fixed optimizer crash on divide-by-zero expressions.(#891) - Added clearing of read/write events for global matrix_cls.(#897) - Added `ode_adjoint_tol_ctl` and improved type printing with variadic ODEs.(#900) v2.26.1 (15 February 2021) ====================================================================== - Fixed issue with not allowing user-defined _lp functions with a void return type in transformed parameters block. v2.26.0 (26 January 2021) ====================================================================== - Added deprecated functions warnings to regular use, and replace in canonicalizer.(#726) - Added a small readme for dockerfiles usage locally.(#738) - Added `matrix chol2inv(matrix)`.(#740) - Added a Github Actions job to build binaries.(#747) - Modified code-generation for user-defined functions to accept Eigen expressions.(#752) - Added OpenCL support for: bernoulli_lpmf, bernoulli_logit_lpmf, beta_lpdf, beta_proportion_lpdf, binomial_lpmf, cauchy_lpdf, chi_square_lpdf, double_exponential_lpdf, exp_mod_normal_lpdf, exponential_lpdf, frechet_lpdf, gamma_lpdf, gumbel_lpdf, inv_chi_square_lpdf, inv_gamma_lpdf, logistic_lpdf, lognormal_lpdf, neg_binomial_lpmf, neg_binomial_2_lpmf, neg_binomial_2_log_lpmf, normal_lpdf, pareto_lpdf, pareto_type_2_lpdf, poisson_lpmf, poisson_log_lpmf, rayleigh_lpdf, scaled_inv_chi_square_lpdf, skew_normal_lpdf, std_normal_lpdf, student_t_lpdf, uniform_lpdf, weibull_lpdf - Allowed `write_array()`, `log_prob()`, and `transform_inits()` to avoid a vector copy and read/write(#761) - Added the discrete_range distribution.(#763) - Use Eigen comma initializer to avoid copy in vector construction.(#766) - Allowed calling lp functions in transformed parameters block.(#767) - Fixed multi-dim indexing bug.(#768) - Moved the reported location of parsing errors closer to the problematic section.(#771) - Fixed a optimization bug in handling of unnormalized distributions.(#778) - Added profiling to the Stan language.(#794) - Added `linspaced_int_array()`(#796) v2.25.0 (26 October 2020) ====================================================================== - Improved parser error message on missing semicolon in the data or parameters block. - Expanded OpenCL (GPU) support for GLMs to now handle parameters for any argument. - Fix parameter unconstraining bug when the constraints depend on other constrained parameters. - "offset, "multiplier," "lower," and "upper" are no longer reserved keywords and can be used in the names of identifiers. - Extended `elt_multiply` (`.*`) and `elt_divide` (`./`) to cases where both inputs are scalars. - Added support for unnormalized distributions for the `target +=` sytnax. - Changed the MIR to represent function declarations as Options. - Variable names are now allowed that shadow math function names. - Fixed a bug with not recognizing transformed parameters in pedantic mode - Added vectorised binary functions: - bessel_first_kind - beta - binary_log_loss - binomial_coefficient_log - choose - falling_factorial - fdim - fmax - fmin - fmod - gamma_p - gamma_q - hypot - lbeta - ldexp - lmgamma - log_diff_exp - log_falling_factorial - log_inv_logit_diff - log_modified_bessel_first_kind - log_rising_factorial - modified_bessel_first_kind - modified_bessel_second_kind - lmultiply - multiply_log - owens_t - rising_factorial Code contributions were made by @andrjohns @nhuurre @rok-cesnovar @rybern and @seantalts v2.24.1 (11 August 2020) ====================================================================== Bugfixes: - added using std::pow to generated code - fixed code generation for pow() - added data quantifier to linspaced_* signatures - fixed code generation for empty matrices v2.24.0 (28 July 2020) ====================================================================== New functions: `algebra_solver_newton` `matrix hmm_hidden_state_prob(matrix, matrix, vector)` `int[] hmm_latent_rng(matrix, matrix, vector)` `real hmm_marginal(matrix, matrix, vector)` `T lambert_w0(T)`, for any T `T lambert_w1(T)`, for any T `matrix matrix_power(matrix, int)` `real multinomial_logit_log(int[], vector)` `real multinomial_logit_lpmf(int[], vector)` `int[] multinomial_logit_rng(vector, int)` `ode_adams`, `ode_adams_tol` `ode_bdf`, `ode_bdf_tol` `ode_rk45`, `ode_rk45_tol` `T pow(int, T)` `T pow(real, T)` `T pow(T, int)` `T pow(T, real) ` (previously only real pow(real, real) was available) `T reverse(T)`, where T is vector, row_vector or an array of any type `matrix identity_matrix(int)` `real[] linspaced_array(int, real, real); row_vector linspaced_row_vector(int, real, real); vector linspaced_vector(int, real, real)` `int[] one_hot_int_array(int, int); real[] one_hot_array(int, int); row_vector one_hot_row_vector(int, int); vector one_hot_vector(int, int)` `int[] ones_int_array(int); real[] ones_array(int); row_vector ones_row_vector(int); vector ones_vector(int)` `vector uniform_simplex(int)` `int[] zeros_int_array(int); real[] zeros_array(int); row_vector zeros_row_vector(int); vector zeros_vector(int)` New features: - pedantic mode - experimental optimization mode - new integer division operator `%/%` - non-scalar values are now allowed in lower, upper, offset and multiplier - integrate_ode_* functions are now deprecated - data-only restricted functions now work with parameters in generated quantities - improved out-of-bounds messages for vectors, matrices - added checks for invalid literals - `--allow_undefined` and `--include_paths` are deprecated in favor of `--allow-undefined` and `--include-paths` - cleaned up the generated model C++ code: model is now final, using statements instead of typedef, better use of inline, use of `.clear()` instead of `.resize(0)`, remove unnecessary functions - cleaned up the OCaml code: better use of helper functions, removed duplicate functions, better exception messages, replace imperative code for handling Stan Math signatures - size expressions for parameters and generated quantities are now only evaluated once - better handle model names that are not C++ friendly (start with numbers, have non-alphanumeric characters) Bugfixes: - changed the loop index type to int to prevent issues when using it in expressions with signed numbers - integer arrays now initialize to the smallest representable integer - var arrays initialize with a prebuilt dummy var, to not creat new varis - all map_rect calls are registered when using MPI - _lpdf/_lpmf functions are now used instead of *_log when generating code for the tilde statements - single argument distribution do not require the vertical bar anymore (e.g. std_normal_lpdf(x|)) - fixed a bug that caused tilde statements to conflict with userdef functions - rng functions are no longer allowed in size declarations - fixed the _lpdf functor struct so that UDF with _log and int argument now compile - fixed array literal type-checking - fixed the error messages for missing input (line number is now displayed properly) - fixed indexing in transform_init() - fixed emitting generated quantities only (for gq_writer) - fixed debug data generator for constrained matrix types and added array value bounds