-
-
Notifications
You must be signed in to change notification settings - Fork 198
Quick Start
Daniel Lee edited this page May 16, 2018
·
7 revisions
If you're using the Stan Math Library, you should only include one header file. The most common one to include is stan/math.hpp.
To choose the correct include, you'll need to know two things:
- primitive (no auto-diff) vs reverse-mode autodiff vs forward-mode autodiff vs mixed autodiff (includes both reverse and forward-mode)
- scalar (no
std::vectororEigen::Matrix) vs array (std::vector, but noEigen::Matrix) vs matrix (includes array)
Once you picked what you want to use, you'll include:
-
stan/math/prim/scal.hppfor primitive and scalar -
stan/math/prim/arr.hppfor primitive and array -
stan/math/prim/mat.hppfor primitive and matrix -
stan/math/rev/scal.hppfor reverse-mode and scalar -
stan/math/rev/arr.hppfor reverse-mode and array -
stan/math/rev/mat.hppfor reverse-mode and matrix. This is what's included when you includestan/math.hpp -
stan/math/fwd/scal.hppfor forward-mode and scalar -
stan/math/fwd/arr.hppfor forward-mode and array -
stan/math/fwd/mat.hppfor forward-mode and matrix -
stan/math/mix/scal.hppfor mixed-mode and scalar -
stan/math/mix/arr.hppfor mixed-mode and array -
stan/math/mix/mat.hppfor mixed-mode and matrix.
The reason we provide these files is because we need to make sure that we instantiate traits in the correct order for the Eigen traits and the std::numeric_limits traits. If we try to specialize a template after instantiating the template, then it's too late and it won't compile or we'll have other issues. See this discussion for more details:
Home | Users | Developers