Stan Dev Math Versions Save

The Stan Math Library is a C++ template library for automatic differentiation of any order using forward, reverse, and mixed modes. It includes a range of built-in functions for probabilistic modeling, linear algebra, and equation solving.

v4.5.0

1 year ago
  • Added the generalised hypergeometric function. (#2510)
  • Added var<Matrix> overloads for pow(), owens_t(), log_inv_logit . (#2546, #2787, #2806)
  • Add tuple overload and cleanup code for promote_scalar. (#2706)
  • New gradient function allows evaluated gradient to be stored into an array, enabling memory reuse when stan/math called via a FFI. (#2743)
  • Added function for casting double and std::vector<double> types to int and std::vector<int> types(#2771)
  • Added hypergeometric_2F1 function. (#2792)
  • Fix bug with vectorised pow() incorrectly forcing Eigen::Matrix return instead of Eigen::Array. (#2793)
  • Exposed the hypergeometric_3F2 function and improved its numerical stability. (#2797)
  • Fixed incorrect return from log_inv_logit_diff with positive infinity first argument. (#2798)
  • Added reverse-mode specializations for fft2 and inv_fft2. (#2800)
  • Removed the cause of the out-of-order initializer compiler warning.(#2808)
  • Vectorized atan2().(#2812)
  • Added complex_schur_decompose_t and complex_schur_decompose_u.(#2814)
  • Vectroized the conj() function. (#2817)
  • Stan's algebraic solvers now support variadic arguments. (#2820)
  • Fixed forward mode autodiff for FFT functions. (#2821)
  • Added log_sum_exp_signed function for computing log_sum_exp while respecting signs of arguments and tracking the sign of the result. (#2829)
  • stan_print can now print std::tuple types. (#2835)
  • stan::math::minus can now accept std::vector. (#2840)

v4.5.0-rc1

1 year ago

v4.4.0

1 year ago

Complex:

  • Added fast Fourier transform (FFT) implementations of 1D and 2D discrete Fourier transform and their inverses. (#2686, #2750)
  • Added type traits for detecting whether a type has a value type that is complex. (#2694)
  • Added vectorized versions of get_real and get_imag. (#2700)
  • Vectorized complex abs(), to_complex. (#2737, #2749)

New functions:

  • Added the incomplete beta function inverse. (#2637)
  • Added the wishart_cholesky_lpdf, which is the Cholesky parameterization of the Wishart distribution of both the input matrix and the scale matrix. (#2710)
  • Added the inverse Wishart Cholesky parameterization lpdf\lupdf is available along with inv_wishart_cholesky_rng. (#2713)
  • Added the Cholesky parameterization of the multivariate Student's T distribution. (#2715)
  • Added the quantile function of the standard normal density function with log input. (#2744)

Misc:

  • Upgraded Sundials to version 6.1.1. (#2692)
  • Updated Boost to 1.78.0. (#2725)
  • Added namespace qualifiers to size and apply calls for C++17 compatibility. (#2693)
  • Enabled address sanitizer and fix it when running inside Docker in Flatiron CI. (#2702)
  • Made arena_allocator usable for all std containers. (#2708)
  • Added gradient calculation for the a2 input in stan-math for the grad_2F1 function and fixes incorrect return values when z is between -1 and 0. (#2721)
  • Updated the signatures of eigenvalues and eigenvectors to use our pseudo-concept require templates.(#2728)
  • norm1 and norm2 were extended with the apply_vector_unary to accept general std::vectors as well as the Eigen vectors previously supported. (#2742)
  • Cleaned up compiler warnings for unused variables and non-consistent use of class and struct for ops_partials_edge. (#2757)
  • Fixed the check for y in gamma_lpdf so that it now errors if y is not a positive finite value. (#2758)
  • Improved numerical stability of gamma_lcdf gradients (#2767)

v4.4.0-rc1

1 year ago

v4.3.2

2 years ago
  • Fixed template error for fma with matrix inputs.
  • Fixed bug that did not allow for var<Matrix> types with different compile-time rows/cols to be assigned to one another.

v4.3.1

2 years ago
  • Fixed a bug with to_matrix(row_vector) and to_matrix(vector) that cause compile-time issues when the result was not stored in a temporary variable.

v4.3.0

2 years ago
  • Changed constants to static constexpr for efficiency, added Euler's Gamma constant. (#2478)
  • Added lmultiply function that parallels multiply_log so that the language doesn't have to rename. (#2596)
  • Cleaned up tests to include <CL/opencl.hpp> instead of <CL/cl2.hpp>. (#2610)
  • Added missing implementations of that shadow the signatures of math functions in the std:: namespace. (#2612)
  • Bugfix for the bug where 2x2 matrix exponential function outputs NaN for matrices with large eigenvalues. (#2616)
  • Add compiler flag -D_BOOST_LGAMMA to allow users to force use of Boost lgamma implementation. (#2618)
  • More informative error messages for ODE solvers. (#2620)
  • Force linker to respect rpath set at compile time. (#2627)
  • Upgraded Sundials to 6.0.0. (#2629)
  • Added norm1() and norm2(). (#2636)
  • Add missing von_mises_cdf_log and von_mises_ccdf_log signatures. (#2640)
  • Refactored the DAE solver.(#2644)
  • Added the inverse of the complementary error function - inv_erfc(). (#2645)
  • Updated member functions for accessing tangents in scalar fvar types. (#2652)
  • Added support for the new matrix type for GLM functions. (#2655)

v4.3.0-rc1

2 years ago

v4.2.1

2 years ago
  • Fixed issues with Adjoint ODE memory management
  • Fixed included OpenCL headers

v4.2.0

2 years ago

Miscellaneous:

  • Updated Powell and Newton solvers to use an adjoint method to propagate derivatives in reverse mode which should result in modest speed-up. Added variadic interfaces (algebra_solver_powell_impl and algebra_solver_newton_impl). (#2421)
  • Cleanup unused local typedefs. (#2505)
  • Fix tbb initialization so that if STAN_THREADS is not defined then the number of threads is set to 1. (#2514)
  • Bugfix for range checks not overriding STAN_THREADS. (#2530)
  • Bugfix for vectorized log include order. (#2542)
  • Added vectorized checks called by the stanc compiler. (#2556)
  • Adds an overload for the constrain functions on whether to accumulate jacobians into log probability argument.(#2559)
  • Updated algorithm for inv_Phi which is approximately 2x faster with precision of 16 digits. Based on the Fortran algorithm described in Wichura, M. J. (1988) Algorithm AS 241: The percentage points of the normal distribution. Applied Statistics, 37, 477–484.(#2566)
  • Vectorized unconstrain and constraing functions. (#2574, #2580)
  • Fixed generalized inverse so that it works for less than full rank symmetric matrices. (#2577)

Varmat:

  • Added var<Matrix> overloads for append_row(), append_col(), rep_vector(), rep_row_vector(), to_vector(), divide(). (#2484, #2487, #2521, #2557)
  • Added nested vectorized functions for the new matrix type. (#2502)
  • Added support for basic slicing and dimension queries operators support var<Matrix> types. (#2507)
  • Added several unary functions for var<Matrix> as well as division.(#2527)
  • Allow accumulator to accept var<Matrix> matrix types(#2535)

Complex:

  • Unary vectorized functions support containers of complex numbers(#2549)
  • Added complex scalar functions get_real(), get_imag(), and to_complex.(#2554)

OpenCL:

  • Added prim-only OpenCL implementations for qr_Q, qr_R, qr_thin_Q, qr_thin_R. (#2479)
  • Fixed a bug for kernel generator operation block, eigenvalues_sym, eigenvectors_sym. (#2479, #2512)
  • Added OpenCL implementation for cumulative_sum. (#2483)
  • Fixed a bug that made OpenCL identity_matrix unusable. (#2499)
  • Added reverse mode for indexing.(#2511)
  • Fixed a number of bugs related to conversions of arena_matrix_cl into matrix_cl. Before this PR such a conversion invoked kernel generator and made a copy of data. Now only references to data are updated.(#2538)
  • Fixes kernel generator allocating more local memory than it needed.(#2541)
  • Added OpenCL implementation of sorting (sort_asc and sort_desc).(#2550)
  • Bugfix OpenCL kernels so that they can no longer modify a const matrix_cl.(#2553)