-
-
Notifications
You must be signed in to change notification settings - Fork 199
Closed
Description
We need to specialize traits for sizes and costs of operations. As is, they're all wrong for all of our autodiff types. See:
http://eigen.tuxfamily.org/dox/structEigen_1_1NumTraits.html
for what they should be.
Right now, there's a rather random set of includes of NumTraits:
~/cmdstan/stan/lib/stan_math(feature/issue-202-vectorize-all)$ grep -R NumTraits stan/
stan//math/fwd/mat/fun/Eigen_NumTraits.hpp: struct NumTraits<stan::math::fvar<T> > {
stan//math/fwd/mat/fun/Eigen_NumTraits.hpp: return 1e-12; // copied from NumTraits.h values for double
stan//math/fwd/mat/fun/typedefs.hpp:#include <stan/math/fwd/mat/fun/Eigen_NumTraits.hpp>
stan//math/mix/mat/fun/typedefs.hpp:#include <stan/math/fwd/mat/fun/Eigen_NumTraits.hpp>
stan//math/prim/mat/fun/Eigen.hpp:#include <Eigen/src/Core/NumTraits.h>
stan//math/rev/core/matrix_vari.hpp:#include <stan/math/rev/mat/fun/Eigen_NumTraits.hpp>
stan//math/rev/mat/fun/Eigen_NumTraits.hpp: struct NumTraits<stan::math::var> {
stan//math/rev/mat/fun/Eigen_NumTraits.hpp: return 1e-12; // copied from NumTraits.h values for double
stan//math/rev/mat/fun/grad.hpp:#include <stan/math/rev/mat/fun/Eigen_NumTraits.hpp>
stan//math/rev/mat/fun/multiply.hpp:#include <stan/math/rev/mat/fun/Eigen_NumTraits.hpp>
stan//math/rev/mat/fun/tcrossprod.hpp:#include <stan/math/rev/mat/fun/Eigen_NumTraits.hpp>
stan//math.hpp:#include <stan/math/rev/mat/fun/Eigen_NumTraits.hpp>
We can deal with the include order issues by brute force (rather than by converting functions to struct calls) by breaking out includes for product of
{ prim, rev, fwd, mix } x { scal, arr, mat }
The current stan/math.hpp is (rev, mat).