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.
Eigen assertions from Stan code are always indicative of a bug (see #3075, most recently) but they lack any contextual information about where the assertion occurs. We can inject this ourselves using the Boost.Stacktrace library, which would make reports much easier to debug.
This will report both the C++ traceback, and because it is a normal exception, the location in the Stan source file which triggered it.
Boost.Stacktrace does require some extra libraries, which are pre-installed on *Nix-like, but may not be on Windows, so we may want to add the above behind a STAN_DEBUG flag or similar.
Description
Eigen assertions from Stan code are always indicative of a bug (see #3075, most recently) but they lack any contextual information about where the assertion occurs. We can inject this ourselves using the Boost.Stacktrace library, which would make reports much easier to debug.
For example, this code seems to work on Linux:
This will report both the C++ traceback, and because it is a normal exception, the location in the Stan source file which triggered it.
Boost.Stacktrace does require some extra libraries, which are pre-installed on *Nix-like, but may not be on Windows, so we may want to add the above behind a
STAN_DEBUG
flag or similar.Current Version:
v4.9.0