I am happy to announce that the latest release candidates of Cmdstan and Stan are now available on Github!
This release cycle brings complex vectors and matrices, 6 new functions and 3 new distributions.
You can find the release candidate for cmdstan here. Instructions for installing are given at the bottom of this post.
Please test the release candidate with your models and report if you experience any problems. We also kindly invite you to test the new features and provide feedback. If you feel some of the new features could be improved or should be changed before the release, please do not hesitate to comment.
The Stan development team appreciates your time and help in making Stan more efficient while maintaining a high level of reliability.
If everything goes according to plan, the 2.30 version will be released in about ten days.
Below are some of the highlights of the new release.
Complex vectors, row_vector and matrices
The Stan language gains three new types: complex_vector
, complex_row_vector
and complex_matrix
with a number of functions that support them:
- abs,
- columns_dot_self,
- cumulative_sum,
- diag_matrix,
- diagonal,
- dot_self,
- eigenvalues_sym,
- eigenvectors_sym,
- fft,
- fft2,
- inv_fft,
- inv_ftt2,
- prod,
- reverse,
- rows_dot_self,
- singular_values,
- sum,
- svd_U,
- svd_V,
- symmetrize_from_lower_tri,
- transpose,
- trace
Other utility functions:
- get_imag, get_real,
- cols, rows, num_elements, size,
- to_array_1d, to_matrix, to_row_vector, to_vector
fft()
returns the Fourier transform of a vector, while fft2()
can be used for the 2-dimensional case of the Fast Fourier transform. The inv_fft()
and inv_fft2()
provide the respective inverse transforms. More details on the FFT functions are temporarily available here. The rest of the listed functions are all existing functions that were extended to support the new complex types.
In addition to these, two new functions were added that return complex vectors/matrices: eigenvectors
and eigenvalues
. See the next section for details.
Note that real vectors/matrices automatically promote complex vector/matrices, which means that supplying a vector to fft(complex_vector)
will work seamlessly, with no need to wrap the vector in a to_complex()
.
New functions
-
eigenvectors
andeigenvalues
:
eigenvalues
returns the complex-valued vector of eigenvalues of the matrix A. The eigenvalues are repeated according to their algebraic multiplicity, so there are as many
eigenvalues as rows in the matrix. The eigenvalues are not sorted in any particular order. eigenvectors
returns the matrix with the complex-valued (column) eigenvectors of
the matrix A in the same order as returned by eigenvalues
.
inv_inc_beta
The inverse of the regularized incomplete beta function. The return value x
is the value that solves p = inc_beta(alpha, beta, x)
.
log_determinant_spd
The log of the absolute value of the determinant of the symmetric, positive-definite matrix A. This function is faster when the input matrix is known to be symmetric and positive definite.
-
norm1
,norm2
These functions return the L1 and L2 norms.
New distributions
- Multivariate Student-t distribution, Cholesky parameterization:
multi_student_t_cholesky_lpdf
andmulti_student_t_cholesky_rng
- Wishart distribution, Cholesky Parameterization:
wishart_cholesky_lpdf
andwishart_cholesky_rng
- Inverse Wishart distribution, Cholesky Parameterization:
inv_wishart_cholesky_lpdf
andinv_wishart_cholesky_rng
Deprecations
The fabs()
function is now deprecated and will be removed in the 2.33.0 release (estimated to be released in June 2023). All usages of fabs()
can be replaced with abs()
.
Discontinued support for Rtools 3.5 on Windows
The Stan 2.30 release can not be used with the Rtools 3.5 toolchain on Windows. The recommended toolchain on Windows is Rtools40, unless you are using Stan with R 4.2+, in which
case Rtools42 should be used.
Toolchain support on Mac and Linux systems should remain unchanged.
Miscellaneous
- Downstream libraries were updated: Sundials to 6.1.1 and Boost to 1.78.0
-
./
and.*
, as well as/
, and*
now support the same input types. The support was not consistent in previous versions. - Exposed an overload for
cumulative_sum
which takes and returns an array of integers.
How to install?
Download the tar.gz file from the link above, extract it and use it the way you use any Cmdstan release. We also have an online Cmdstan guide available at Redirecting…
If you are using cmdstanpy you can install the release candidate using
cmdstanpy.install_cmdstan(version='2.30.0-rc1')
With CmdStanR you can install the release candidate using
cmdstanr::install_cmdstan(version = "2.30.0-rc1", cores = 4)
And then select the RC with
cmdstanr::set_cmdstan_path(file.path(Sys.getenv("HOME"), ".cmdstan", "cmdstan-2.30.0-rc1"))