stan-dev / math

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.
https://mc-stan.org
BSD 3-Clause "New" or "Revised" License
756 stars 188 forks source link

abs(real) translates to C++ but fails to compile #907

Closed bob-carpenter closed 5 years ago

bob-carpenter commented 6 years ago

Summary:

See title. This is a stan-dev/math issue.

A stan::math::abs() implementation implementation would probably solve the problem.

Reproducible Steps:

parameters {
  real y;
}
model {
  abs(y) ~ normal(0, 1);
}

Current Output:

This is from RStan:

> stan_model("abs.stan")
DIAGNOSTIC(S) FROM PARSER:Warning: Function abs(real) is deprecated in the Stan language.
         It will be removed in a future release.
         Use fabs(real) instead.

Warning (non-fatal):
Left-hand side of sampling statement (~) may contain a non-linear transform of a parameter or local variable.
If it does, you need to include a target += statement with the log absolute determinant of the Jacobian of the transform.
Left-hand-side of sampling statement:
    abs(y) ~ normal(...)
In file included from file13a3a0b4560.cpp:8:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/mat.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/core.hpp:14:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/core/matrix_vari.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/mat/fun/Eigen_NumTraits.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:1:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Core:531:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from file13a3a0b4560.cpp:8:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/mat.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/core.hpp:14:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/core/matrix_vari.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/mat/fun/Eigen_NumTraits.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:2:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/LU:47:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from file13a3a0b4560.cpp:8:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/mat.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/core.hpp:14:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/core/matrix_vari.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/mat/fun/Eigen_NumTraits.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:3:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Cholesky:12:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Jacobi:29:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from file13a3a0b4560.cpp:8:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/mat.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/core.hpp:14:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/core/matrix_vari.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/mat/fun/Eigen_NumTraits.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:3:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Cholesky:43:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from file13a3a0b4560.cpp:8:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/mat.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/core.hpp:14:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/core/matrix_vari.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/mat/fun/Eigen_NumTraits.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/QR:17:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Householder:27:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from file13a3a0b4560.cpp:8:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/mat.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/core.hpp:14:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/core/matrix_vari.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/mat/fun/Eigen_NumTraits.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:5:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/SVD:48:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from file13a3a0b4560.cpp:8:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/mat.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/core.hpp:14:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/core/matrix_vari.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/mat/fun/Eigen_NumTraits.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:6:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Geometry:58:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from file13a3a0b4560.cpp:8:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/mat.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/core.hpp:14:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/core/matrix_vari.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/mat/fun/Eigen_NumTraits.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Dense:7:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Eigenvalues:58:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from file13a3a0b4560.cpp:8:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/mat.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/core.hpp:36:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/core/operator_unary_plus.hpp:7:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/prim/scal/fun/constants.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/math/constants/constants.hpp:13:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/math/tools/convert_from_string.hpp:15:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/lexical_cast.hpp:32:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/lexical_cast/try_lexical_convert.hpp:42:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/lexical_cast/detail/converter_lexical.hpp:52:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/container/container_fwd.hpp:61:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/container/detail/std_fwd.hpp:27:1: warning: inline namespaces are a C++11 feature [-Wc++11-inline-namespace]
BOOST_MOVE_STD_NS_BEG
^
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/move/detail/std_ns_begin.hpp:18:34: note: expanded from macro 'BOOST_MOVE_STD_NS_BEG'
   #define BOOST_MOVE_STD_NS_BEG _LIBCPP_BEGIN_NAMESPACE_STD
                                 ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__config:439:52: note: expanded from macro '_LIBCPP_BEGIN_NAMESPACE_STD'
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
                                                   ^
In file included from file13a3a0b4560.cpp:8:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/mat.hpp:12:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/prim/mat.hpp:83:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/csr_extract_u.hpp:6:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Sparse:26:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/SparseCore:66:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from file13a3a0b4560.cpp:8:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/mat.hpp:12:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/prim/mat.hpp:83:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/csr_extract_u.hpp:6:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Sparse:27:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/OrderingMethods:71:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from file13a3a0b4560.cpp:8:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/mat.hpp:12:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/prim/mat.hpp:83:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/csr_extract_u.hpp:6:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Sparse:29:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/SparseCholesky:43:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from file13a3a0b4560.cpp:8:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/mat.hpp:12:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/prim/mat.hpp:83:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/csr_extract_u.hpp:6:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Sparse:32:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/SparseQR:35:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from file13a3a0b4560.cpp:8:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/mat.hpp:12:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/prim/mat.hpp:83:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/prim/mat/fun/csr_extract_u.hpp:6:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/Sparse:33:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/IterativeLinearSolvers:46:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppEigen/include/Eigen/src/Core/util/ReenableStupidWarnings.h:10:30: warning: pragma diagnostic pop could not pop, no matching push [-Wunknown-pragmas]
    #pragma clang diagnostic pop
                             ^
In file included from file13a3a0b4560.cpp:308:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rstan/include/rstan/rstaninc.hpp:3:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rstan/include/rstan/stan_fit.hpp:36:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/services/optimize/bfgs.hpp:11:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/optimization/bfgs.hpp:9:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/optimization/lbfgs_update.hpp:6:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/circular_buffer.hpp:54:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/circular_buffer/details.hpp:20:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/move/move.hpp:30:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/move/iterator.hpp:27:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/move/detail/iterator_traits.hpp:29:1: warning: inline namespaces are a C++11 feature [-Wc++11-inline-namespace]
BOOST_MOVE_STD_NS_BEG
^
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/BH/include/boost/move/detail/std_ns_begin.hpp:18:34: note: expanded from macro 'BOOST_MOVE_STD_NS_BEG'
   #define BOOST_MOVE_STD_NS_BEG _LIBCPP_BEGIN_NAMESPACE_STD
                                 ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__config:439:52: note: expanded from macro '_LIBCPP_BEGIN_NAMESPACE_STD'
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
                                                   ^
file13a3a0b4560.cpp:166:49: error: call to 'abs' is ambiguous
            lp_accum__.add(normal_log<propto__>(abs(y), 0, 1));
                                                ^~~
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/services/util/initialize.hpp:114:39: note: in instantiation of function template specialization 'model13a37bc8626_abs_namespace::model13a37bc8626_abs::log_prob<false, true, double>' requested here
            log_prob = model.template log_prob<false, true>
                                      ^
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/services/diagnose/diagnose.hpp:54:19: note: in instantiation of function template specialization 'stan::services::util::initialize<model13a37bc8626_abs_namespace::model13a37bc8626_abs, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> > >' requested here
          = util::initialize(model, init, rng, init_radius,
                  ^
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rstan/include/rstan/stan_fit.hpp:459:45: note: in instantiation of function template specialization 'stan::services::diagnose::diagnose<model13a37bc8626_abs_namespace::model13a37bc8626_abs>' requested here
    return_code = stan::services::diagnose::diagnose(model,
                                            ^
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rstan/include/rstan/stan_fit.hpp:1196:11: note: in instantiation of function template specialization 'rstan::(anonymous namespace)::command<model13a37bc8626_abs_namespace::model13a37bc8626_abs, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> > >' requested here
    ret = command(args, model_, holder, names_oi_tidx_,
          ^
file13a3a0b4560.cpp:319:112: note: in instantiation of member function 'rstan::stan_fit<model13a37bc8626_abs_namespace::model13a37bc8626_abs, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> > >::call_sampler' requested here
            &rstan::stan_fit<model13a37bc8626_abs_namespace::model13a37bc8626_abs, boost::random::ecuyer1988>::call_sampler)
                                                                                                               ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:737:1: note: candidate function
abs(double __lcpp_x) _NOEXCEPT {return ::fabs(__lcpp_x);}
^
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/prim/scal/fun/abs.hpp:18:19: note: candidate function
    inline double abs(double x) {
                  ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/stdlib.h:137:6: note: candidate function
int      abs(int) __pure2;
         ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdlib.h:111:44: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY long      abs(     long __x) _NOEXCEPT {return  labs(__x);}
                                           ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdlib.h:113:44: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
                                           ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:733:1: note: candidate function
abs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:741:1: note: candidate function
abs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
^
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/scal/fun/abs.hpp:35:16: note: candidate function
    inline var abs(const var& a) {
               ^
In file included from file13a3a0b4560.cpp:308:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rstan/include/rstan/rstaninc.hpp:3:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rstan/include/rstan/stan_fit.hpp:35:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/services/diagnose/diagnose.hpp:10:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/model/test_gradients.hpp:6:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/model/finite_diff_grad.hpp:46:21: error: no matching member function for call to 'log_prob'
          .template log_prob<propto,
          ~~~~~~~~~~^~~~~~~~~~~~~~~~
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/model/test_gradients.hpp:62:7: note: in instantiation of function template specialization 'stan::model::finite_diff_grad<false, true, model13a37bc8626_abs_namespace::model13a37bc8626_abs>' requested here
      finite_diff_grad<false, true, Model>(model, interrupt, params_r, params_i,
      ^
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/services/diagnose/diagnose.hpp:61:26: note: in instantiation of function template specialization 'stan::model::test_gradients<true, true, model13a37bc8626_abs_namespace::model13a37bc8626_abs>' requested here
          = stan::model::test_gradients<true, true>(model, cont_vector,
                         ^
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rstan/include/rstan/stan_fit.hpp:459:45: note: in instantiation of function template specialization 'stan::services::diagnose::diagnose<model13a37bc8626_abs_namespace::model13a37bc8626_abs>' requested here
    return_code = stan::services::diagnose::diagnose(model,
                                            ^
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rstan/include/rstan/stan_fit.hpp:1196:11: note: in instantiation of function template specialization 'rstan::(anonymous namespace)::command<model13a37bc8626_abs_namespace::model13a37bc8626_abs, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> > >' requested here
    ret = command(args, model_, holder, names_oi_tidx_,
          ^
file13a3a0b4560.cpp:319:112: note: in instantiation of member function 'rstan::stan_fit<model13a37bc8626_abs_namespace::model13a37bc8626_abs, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> > >::call_sampler' requested here
            &rstan::stan_fit<model13a37bc8626_abs_namespace::model13a37bc8626_abs, boost::random::ecuyer1988>::call_sampler)
                                                                                                               ^
file13a3a0b4560.cpp:132:9: note: candidate template ignored: substitution failure [with propto__ = false, jacobian__ = true, T__ = double]
    T__ log_prob(vector<T__>& params_r__,
        ^
file13a3a0b4560.cpp:180:8: note: candidate function template not viable: requires at most 2 arguments, but 3 were provided
    T_ log_prob(Eigen::Matrix<T_,Eigen::Dynamic,1>& params_r,
       ^
In file included from file13a3a0b4560.cpp:308:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rstan/include/rstan/rstaninc.hpp:3:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rstan/include/rstan/stan_fit.hpp:35:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/services/diagnose/diagnose.hpp:10:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/model/test_gradients.hpp:6:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/model/finite_diff_grad.hpp:52:21: error: no matching member function for call to 'log_prob'
          .template log_prob<propto,
          ~~~~~~~~~~^~~~~~~~~~~~~~~~
file13a3a0b4560.cpp:132:9: note: candidate template ignored: substitution failure [with propto__ = false, jacobian__ = true, T__ = double]
    T__ log_prob(vector<T__>& params_r__,
        ^
file13a3a0b4560.cpp:180:8: note: candidate function template not viable: requires at most 2 arguments, but 3 were provided
    T_ log_prob(Eigen::Matrix<T_,Eigen::Dynamic,1>& params_r,
       ^
file13a3a0b4560.cpp:166:49: error: call to 'abs' is ambiguous
            lp_accum__.add(normal_log<propto__>(abs(y), 0, 1));
                                                ^~~
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/services/optimize/newton.hpp:61:31: note: in instantiation of function template specialization 'model13a37bc8626_abs_namespace::model13a37bc8626_abs::log_prob<false, false, double>' requested here
          lp = model.template log_prob<false, false>(cont_vector, disc_vector,
                              ^
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rstan/include/rstan/stan_fit.hpp:480:35: note: in instantiation of function template specialization 'stan::services::optimize::newton<model13a37bc8626_abs_namespace::model13a37bc8626_abs>' requested here
      = stan::services::optimize::newton(model, *init_context_ptr,
                                  ^
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rstan/include/rstan/stan_fit.hpp:1196:11: note: in instantiation of function template specialization 'rstan::(anonymous namespace)::command<model13a37bc8626_abs_namespace::model13a37bc8626_abs, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> > >' requested here
    ret = command(args, model_, holder, names_oi_tidx_,
          ^
file13a3a0b4560.cpp:319:112: note: in instantiation of member function 'rstan::stan_fit<model13a37bc8626_abs_namespace::model13a37bc8626_abs, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> > >::call_sampler' requested here
            &rstan::stan_fit<model13a37bc8626_abs_namespace::model13a37bc8626_abs, boost::random::ecuyer1988>::call_sampler)
                                                                                                               ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:737:1: note: candidate function
abs(double __lcpp_x) _NOEXCEPT {return ::fabs(__lcpp_x);}
^
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/prim/scal/fun/abs.hpp:18:19: note: candidate function
    inline double abs(double x) {
                  ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/stdlib.h:137:6: note: candidate function
int      abs(int) __pure2;
         ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdlib.h:111:44: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY long      abs(     long __x) _NOEXCEPT {return  labs(__x);}
                                           ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdlib.h:113:44: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
                                           ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:733:1: note: candidate function
abs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:741:1: note: candidate function
abs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
^
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/scal/fun/abs.hpp:35:16: note: candidate function
    inline var abs(const var& a) {
               ^
file13a3a0b4560.cpp:187:14: error: no matching member function for call to 'log_prob'
      return log_prob<propto,jacobian,T_>(vec_params_r, vec_params_i, pstream);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/variational/advi.hpp:114:47: note: in instantiation of function template specialization 'model13a37bc8626_abs_namespace::model13a37bc8626_abs::log_prob<false, true, double>' requested here
            double log_prob = model_.template log_prob<false, true>(zeta, &ss);
                                              ^
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/variational/advi.hpp:200:23: note: in instantiation of member function 'stan::variational::advi<model13a37bc8626_abs_namespace::model13a37bc8626_abs, stan::variational::normal_fullrank, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> > >::calc_ELBO' requested here
          elbo_init = calc_ELBO(variational, logger);
                      ^
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/variational/advi.hpp:497:17: note: in instantiation of member function 'stan::variational::advi<model13a37bc8626_abs_namespace::model13a37bc8626_abs, stan::variational::normal_fullrank, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> > >::adapt_eta' requested here
          eta = adapt_eta(variational, adapt_iterations, logger);
                ^
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/services/experimental/advi/fullrank.hpp:85:20: note: in instantiation of member function 'stan::variational::advi<model13a37bc8626_abs_namespace::model13a37bc8626_abs, stan::variational::normal_fullrank, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> > >::run' requested here
          cmd_advi.run(eta, adapt_engaged, adapt_iterations,
                   ^
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rstan/include/rstan/stan_fit.hpp:871:9: note: in instantiation of function template specialization 'stan::services::experimental::advi::fullrank<model13a37bc8626_abs_namespace::model13a37bc8626_abs>' requested here
      ::fullrank(model, *init_context_ptr,
        ^
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rstan/include/rstan/stan_fit.hpp:1196:11: note: in instantiation of function template specialization 'rstan::(anonymous namespace)::command<model13a37bc8626_abs_namespace::model13a37bc8626_abs, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> > >' requested here
    ret = command(args, model_, holder, names_oi_tidx_,
          ^
file13a3a0b4560.cpp:319:112: note: in instantiation of member function 'rstan::stan_fit<model13a37bc8626_abs_namespace::model13a37bc8626_abs, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> > >::call_sampler' requested here
            &rstan::stan_fit<model13a37bc8626_abs_namespace::model13a37bc8626_abs, boost::random::ecuyer1988>::call_sampler)
                                                                                                               ^
file13a3a0b4560.cpp:132:9: note: candidate template ignored: substitution failure [with propto__ = false, jacobian__ = true, T__ = double]
    T__ log_prob(vector<T__>& params_r__,
        ^
file13a3a0b4560.cpp:180:8: note: candidate function template not viable: requires at most 2 arguments, but 3 were provided
    T_ log_prob(Eigen::Matrix<T_,Eigen::Dynamic,1>& params_r,
       ^
In file included from file13a3a0b4560.cpp:308:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rstan/include/rstan/rstaninc.hpp:3:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rstan/include/rstan/stan_fit.hpp:52:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/services/experimental/advi/fullrank.hpp:11:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/variational/advi.hpp:114:47: error: no matching member function for call to 'log_prob'
            double log_prob = model_.template log_prob<false, true>(zeta, &ss);
                              ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/variational/advi.hpp:200:23: note: in instantiation of member function 'stan::variational::advi<model13a37bc8626_abs_namespace::model13a37bc8626_abs, stan::variational::normal_meanfield, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> > >::calc_ELBO' requested here
          elbo_init = calc_ELBO(variational, logger);
                      ^
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/variational/advi.hpp:497:17: note: in instantiation of member function 'stan::variational::advi<model13a37bc8626_abs_namespace::model13a37bc8626_abs, stan::variational::normal_meanfield, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> > >::adapt_eta' requested here
          eta = adapt_eta(variational, adapt_iterations, logger);
                ^
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/services/experimental/advi/meanfield.hpp:85:20: note: in instantiation of member function 'stan::variational::advi<model13a37bc8626_abs_namespace::model13a37bc8626_abs, stan::variational::normal_meanfield, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> > >::run' requested here
          cmd_advi.run(eta, adapt_engaged, adapt_iterations,
                   ^
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rstan/include/rstan/stan_fit.hpp:881:9: note: in instantiation of function template specialization 'stan::services::experimental::advi::meanfield<model13a37bc8626_abs_namespace::model13a37bc8626_abs>' requested here
      ::meanfield(model, *init_context_ptr,
        ^
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rstan/include/rstan/stan_fit.hpp:1196:11: note: in instantiation of function template specialization 'rstan::(anonymous namespace)::command<model13a37bc8626_abs_namespace::model13a37bc8626_abs, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> > >' requested here
    ret = command(args, model_, holder, names_oi_tidx_,
          ^
file13a3a0b4560.cpp:319:112: note: in instantiation of member function 'rstan::stan_fit<model13a37bc8626_abs_namespace::model13a37bc8626_abs, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> > >::call_sampler' requested here
            &rstan::stan_fit<model13a37bc8626_abs_namespace::model13a37bc8626_abs, boost::random::ecuyer1988>::call_sampler)
                                                                                                               ^
file13a3a0b4560.cpp:132:9: note: candidate template ignored: could not match 'vector' against 'Matrix'
    T__ log_prob(vector<T__>& params_r__,
        ^
file13a3a0b4560.cpp:180:8: note: candidate template ignored: substitution failure [with propto = false, jacobian = true, T_ = double]
    T_ log_prob(Eigen::Matrix<T_,Eigen::Dynamic,1>& params_r,
       ^
15 warnings and 6 errors generated.
make: *** [file13a3a0b4560.o] Error 1

ERROR(s) during compilation: source code errors or compiler configuration errors!

Program source:
  1: 
  2: // includes from the plugin
  3: 
  4: 
  5: // user includes
  6: #define STAN__SERVICES__COMMAND_HPP// Code generated by Stan version 2.17.0
  7: 
  8: #include <stan/model/model_header.hpp>
  9: 
 10: namespace model13a37bc8626_abs_namespace {
 11: 
 12: using std::istream;
 13: using std::string;
 14: using std::stringstream;
 15: using std::vector;
 16: using stan::io::dump;
 17: using stan::math::lgamma;
 18: using stan::model::prob_grad;
 19: using namespace stan::math;
 20: 
 21: typedef Eigen::Matrix<double,Eigen::Dynamic,1> vector_d;
 22: typedef Eigen::Matrix<double,1,Eigen::Dynamic> row_vector_d;
 23: typedef Eigen::Matrix<double,Eigen::Dynamic,Eigen::Dynamic> matrix_d;
 24: 
 25: static int current_statement_begin__;
 26: 
 27: stan::io::program_reader prog_reader__() {
 28:     stan::io::program_reader reader;
 29:     reader.add_event(0, 0, "start", "model13a37bc8626_abs");
 30:     reader.add_event(6, 6, "end", "model13a37bc8626_abs");
 31:     return reader;
 32: }
 33: 
 34: class model13a37bc8626_abs : public prob_grad {
 35: private:
 36: public:
 37:     model13a37bc8626_abs(stan::io::var_context& context__,
 38:         std::ostream* pstream__ = 0)
 39:         : prob_grad(0) {
 40:         ctor_body(context__, 0, pstream__);
 41:     }
 42: 
 43:     model13a37bc8626_abs(stan::io::var_context& context__,
 44:         unsigned int random_seed__,
 45:         std::ostream* pstream__ = 0)
 46:         : prob_grad(0) {
 47:         ctor_body(context__, random_seed__, pstream__);
 48:     }
 49: 
 50:     void ctor_body(stan::io::var_context& context__,
 51:                    unsigned int random_seed__,
 52:                    std::ostream* pstream__) {
 53:         boost::ecuyer1988 base_rng__ =
 54:           stan::services::util::create_rng(random_seed__, 0);
 55:         (void) base_rng__;  // suppress unused var warning
 56: 
 57:         current_statement_begin__ = -1;
 58: 
 59:         static const char* function__ = "model13a37bc8626_abs_namespace::model13a37bc8626_abs";
 60:         (void) function__;  // dummy to suppress unused var warning
 61:         size_t pos__;
 62:         (void) pos__;  // dummy to suppress unused var warning
 63:         std::vector<int> vals_i__;
 64:         std::vector<double> vals_r__;
 65:         double DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
 66:         (void) DUMMY_VAR__;  // suppress unused var warning
 67: 
 68:         // initialize member variables
 69:         try {
 70: 
 71:             // validate, data variables
 72:             // initialize data variables
 73: 
 74: 
 75:             // validate transformed data
 76: 
 77:             // validate, set parameter ranges
 78:             num_params_r__ = 0U;
 79:             param_ranges_i__.clear();
 80:             current_statement_begin__ = 2;
 81:             ++num_params_r__;
 82:         } catch (const std::exception& e) {
 83:             stan::lang::rethrow_located(e, current_statement_begin__, prog_reader__());
 84:             // Next line prevents compiler griping about no return
 85:             throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***");
 86:         }
 87:     }
 88: 
 89:     ~model13a37bc8626_abs() { }
 90: 
 91: 
 92:     void transform_inits(const stan::io::var_context& context__,
 93:                          std::vector<int>& params_i__,
 94:                          std::vector<double>& params_r__,
 95:                          std::ostream* pstream__) const {
 96:         stan::io::writer<double> writer__(params_r__,params_i__);
 97:         size_t pos__;
 98:         (void) pos__; // dummy call to supress warning
 99:         std::vector<double> vals_r__;
100:         std::vector<int> vals_i__;
101: 
102:         if (!(context__.contains_r("y")))
103:             throw std::runtime_error("variable y missing");
104:         vals_r__ = context__.vals_r("y");
105:         pos__ = 0U;
106:         context__.validate_dims("initialization", "y", "double", context__.to_vec());
107:         double y(0);
108:         y = vals_r__[pos__++];
109:         try {
110:             writer__.scalar_unconstrain(y);
111:         } catch (const std::exception& e) { 
112:             throw std::runtime_error(std::string("Error transforming variable y: ") + e.what());
113:         }
114: 
115:         params_r__ = writer__.data_r();
116:         params_i__ = writer__.data_i();
117:     }
118: 
119:     void transform_inits(const stan::io::var_context& context,
120:                          Eigen::Matrix<double,Eigen::Dynamic,1>& params_r,
121:                          std::ostream* pstream__) const {
122:       std::vector<double> params_r_vec;
123:       std::vector<int> params_i_vec;
124:       transform_inits(context, params_i_vec, params_r_vec, pstream__);
125:       params_r.resize(params_r_vec.size());
126:       for (int i = 0; i < params_r.size(); ++i)
127:         params_r(i) = params_r_vec[i];
128:     }
129: 
130: 
131:     template <bool propto__, bool jacobian__, typename T__>
132:     T__ log_prob(vector<T__>& params_r__,
133:                  vector<int>& params_i__,
134:                  std::ostream* pstream__ = 0) const {
135: 
136:         T__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
137:         (void) DUMMY_VAR__;  // suppress unused var warning
138: 
139:         T__ lp__(0.0);
140:         stan::math::accumulator<T__> lp_accum__;
141: 
142:         try {
143:             // model parameters
144:             stan::io::reader<T__> in__(params_r__,params_i__);
145: 
146:             T__ y;
147:             (void) y;  // dummy to suppress unused var warning
148:             if (jacobian__)
149:                 y = in__.scalar_constrain(lp__);
150:             else
151:                 y = in__.scalar_constrain();
152: 
153: 
154:             // transformed parameters
155: 
156: 
157: 
158:             // validate transformed parameters
159: 
160:             const char* function__ = "validate transformed params";
161:             (void) function__;  // dummy to suppress unused var warning
162: 
163:             // model body
164: 
165:             current_statement_begin__ = 5;
166:             lp_accum__.add(normal_log<propto__>(abs(y), 0, 1));
167: 
168:         } catch (const std::exception& e) {
169:             stan::lang::rethrow_located(e, current_statement_begin__, prog_reader__());
170:             // Next line prevents compiler griping about no return
171:             throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***");
172:         }
173: 
174:         lp_accum__.add(lp__);
175:         return lp_accum__.sum();
176: 
177:     } // log_prob()
178: 
179:     template <bool propto, bool jacobian, typename T_>
180:     T_ log_prob(Eigen::Matrix<T_,Eigen::Dynamic,1>& params_r,
181:                std::ostream* pstream = 0) const {
182:       std::vector<T_> vec_params_r;
183:       vec_params_r.reserve(params_r.size());
184:       for (int i = 0; i < params_r.size(); ++i)
185:         vec_params_r.push_back(params_r(i));
186:       std::vector<int> vec_params_i;
187:       return log_prob<propto,jacobian,T_>(vec_params_r, vec_params_i, pstream);
188:     }
189: 
190: 
191:     void get_param_names(std::vector<std::string>& names__) const {
192:         names__.resize(0);
193:         names__.push_back("y");
194:     }
195: 
196: 
197:     void get_dims(std::vector<std::vector<size_t> >& dimss__) const {
198:         dimss__.resize(0);
199:         std::vector<size_t> dims__;
200:         dims__.resize(0);
201:         dimss__.push_back(dims__);
202:     }
203: 
204:     template <typename RNG>
205:     void write_array(RNG& base_rng__,
206:                      std::vector<double>& params_r__,
207:                      std::vector<int>& params_i__,
208:                      std::vector<double>& vars__,
209:                      bool include_tparams__ = true,
210:                      bool include_gqs__ = true,
211:                      std::ostream* pstream__ = 0) const {
212:         vars__.resize(0);
213:         stan::io::reader<double> in__(params_r__,params_i__);
214:         static const char* function__ = "model13a37bc8626_abs_namespace::write_array";
215:         (void) function__;  // dummy to suppress unused var warning
216:         // read-transform, write parameters
217:         double y = in__.scalar_constrain();
218:         vars__.push_back(y);
219: 
220:         if (!include_tparams__) return;
221:         // declare and define transformed parameters
222:         double lp__ = 0.0;
223:         (void) lp__;  // dummy to suppress unused var warning
224:         stan::math::accumulator<double> lp_accum__;
225: 
226:         double DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
227:         (void) DUMMY_VAR__;  // suppress unused var warning
228: 
229:         try {
230: 
231: 
232: 
233:             // validate transformed parameters
234: 
235:             // write transformed parameters
236: 
237:             if (!include_gqs__) return;
238:             // declare and define generated quantities
239: 
240: 
241: 
242:             // validate generated quantities
243: 
244:             // write generated quantities
245:         } catch (const std::exception& e) {
246:             stan::lang::rethrow_located(e, current_statement_begin__, prog_reader__());
247:             // Next line prevents compiler griping about no return
248:             throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***");
249:         }
250:     }
251: 
252:     template <typename RNG>
253:     void write_array(RNG& base_rng,
254:                      Eigen::Matrix<double,Eigen::Dynamic,1>& params_r,
255:                      Eigen::Matrix<double,Eigen::Dynamic,1>& vars,
256:                      bool include_tparams = true,
257:                      bool include_gqs = true,
258:                      std::ostream* pstream = 0) const {
259:       std::vector<double> params_r_vec(params_r.size());
260:       for (int i = 0; i < params_r.size(); ++i)
261:         params_r_vec[i] = params_r(i);
262:       std::vector<double> vars_vec;
263:       std::vector<int> params_i_vec;
264:       write_array(base_rng,params_r_vec,params_i_vec,vars_vec,include_tparams,include_gqs,pstream);
265:       vars.resize(vars_vec.size());
266:       for (int i = 0; i < vars.size(); ++i)
267:         vars(i) = vars_vec[i];
268:     }
269: 
270:     static std::string model_name() {
271:         return "model13a37bc8626_abs";
272:     }
273: 
274: 
275:     void constrained_param_names(std::vector<std::string>& param_names__,
276:                                  bool include_tparams__ = true,
277:                                  bool include_gqs__ = true) const {
278:         std::stringstream param_name_stream__;
279:         param_name_stream__.str(std::string());
280:         param_name_stream__ << "y";
281:         param_names__.push_back(param_name_stream__.str());
282: 
283:         if (!include_gqs__ && !include_tparams__) return;
284: 
285:         if (!include_gqs__) return;
286:     }
287: 
288: 
289:     void unconstrained_param_names(std::vector<std::string>& param_names__,
290:                                    bool include_tparams__ = true,
291:                                    bool include_gqs__ = true) const {
292:         std::stringstream param_name_stream__;
293:         param_name_stream__.str(std::string());
294:         param_name_stream__ << "y";
295:         param_names__.push_back(param_name_stream__.str());
296: 
297:         if (!include_gqs__ && !include_tparams__) return;
298: 
299:         if (!include_gqs__) return;
300:     }
301: 
302: }; // model
303: 
304: }
305: 
306: typedef model13a37bc8626_abs_namespace::model13a37bc8626_abs stan_model;
307: 
308: #include <rstan/rstaninc.hpp>
309: /**
310:  * Define Rcpp Module to expose stan_fit's functions to R.
311:  */
312: RCPP_MODULE(stan_fit4model13a37bc8626_abs_mod){
313:   Rcpp::class_<rstan::stan_fit<model13a37bc8626_abs_namespace::model13a37bc8626_abs,
314:                boost::random::ecuyer1988> >("stan_fit4model13a37bc8626_abs")
315:     // .constructor<Rcpp::List>()
316:     .constructor<SEXP, SEXP, SEXP>()
317:     // .constructor<SEXP, SEXP>()
318:     .method("call_sampler",
319:             &rstan::stan_fit<model13a37bc8626_abs_namespace::model13a37bc8626_abs, boost::random::ecuyer1988>::call_sampler)
320:     .method("param_names",
321:             &rstan::stan_fit<model13a37bc8626_abs_namespace::model13a37bc8626_abs, boost::random::ecuyer1988>::param_names)
322:     .method("param_names_oi",
323:             &rstan::stan_fit<model13a37bc8626_abs_namespace::model13a37bc8626_abs, boost::random::ecuyer1988>::param_names_oi)
324:     .method("param_fnames_oi",
325:             &rstan::stan_fit<model13a37bc8626_abs_namespace::model13a37bc8626_abs, boost::random::ecuyer1988>::param_fnames_oi)
326:     .method("param_dims",
327:             &rstan::stan_fit<model13a37bc8626_abs_namespace::model13a37bc8626_abs, boost::random::ecuyer1988>::param_dims)
328:     .method("param_dims_oi",
329:             &rstan::stan_fit<model13a37bc8626_abs_namespace::model13a37bc8626_abs, boost::random::ecuyer1988>::param_dims_oi)
330:     .method("update_param_oi",
331:             &rstan::stan_fit<model13a37bc8626_abs_namespace::model13a37bc8626_abs, boost::random::ecuyer1988>::update_param_oi)
332:     .method("param_oi_tidx",
333:             &rstan::stan_fit<model13a37bc8626_abs_namespace::model13a37bc8626_abs, boost::random::ecuyer1988>::param_oi_tidx)
334:     .method("grad_log_prob",
335:             &rstan::stan_fit<model13a37bc8626_abs_namespace::model13a37bc8626_abs, boost::random::ecuyer1988>::grad_log_prob)
336:     .method("log_prob",
337:             &rstan::stan_fit<model13a37bc8626_abs_namespace::model13a37bc8626_abs, boost::random::ecuyer1988>::log_prob)
338:     .method("unconstrain_pars",
339:             &rstan::stan_fit<model13a37bc8626_abs_namespace::model13a37bc8626_abs, boost::random::ecuyer1988>::unconstrain_pars)
340:     .method("constrain_pars",
341:             &rstan::stan_fit<model13a37bc8626_abs_namespace::model13a37bc8626_abs, boost::random::ecuyer1988>::constrain_pars)
342:     .method("num_pars_unconstrained",
343:             &rstan::stan_fit<model13a37bc8626_abs_namespace::model13a37bc8626_abs, boost::random::ecuyer1988>::num_pars_unconstrained)
344:     .method("unconstrained_param_names",
345:             &rstan::stan_fit<model13a37bc8626_abs_namespace::model13a37bc8626_abs, boost::random::ecuyer1988>::unconstrained_param_names)
346:     .method("constrained_param_names",
347:             &rstan::stan_fit<model13a37bc8626_abs_namespace::model13a37bc8626_abs, boost::random::ecuyer1988>::constrained_param_names)
348:     ;
349: }
350: 
351: // declarations
352: extern "C" {
353: SEXP file13a3a0b4560( ) ;
354: }
355: 
356: // definition
357: 
358: SEXP file13a3a0b4560(  ){
359:  return Rcpp::wrap("abs");
360: }
361: 
362: 
Error in compileCode(f, code, language = language, verbose = verbose) : 
  Compilation ERROR, function(s)/method(s) not created! In file included from file13a3a0b4560.cpp:8:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/mat.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/core.hpp:14:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/core/matrix_vari.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/mat/fun/Eigen_NumTraits.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resourc
In addition: Warning message:
In system(cmd, intern = !verbose) :
  running command '/Library/Frameworks/R.framework/Resources/bin/R CMD SHLIB file13a3a0b4560.cpp 2> file13a3a0b4560.cpp.err.txt' had status 1
> 

Expected Output:

Compilation.

Current Version:

v2.17.0

> sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.5

Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] rstan_2.17.3       StanHeaders_2.17.2 ggplot2_2.2.1     

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.17     grid_3.5.0       plyr_1.8.4       gtable_0.2.0     stats4_3.5.0     scales_0.5.0    
 [7] pillar_1.2.3     rlang_0.2.1      lazyeval_0.2.1   tools_3.5.0      munsell_0.4.3    compiler_3.5.0  
[13] inline_0.3.15    colorspace_1.3-2 gridExtra_2.3    tibble_1.4.2    
> 
syclik commented 6 years ago

@bob-carpenter, I don't think this is a math problem. I think it's an RStan problem.

I was able to compile the program in CmdStan on my Mac. I verified that I can not compile it using RStan 2.17.3 on my Mac.

bgoodri commented 6 years ago

It is not an RStan issue; it is, however, the same Stan Math 2.17.0 issue that has come up several times in the past month. 2.17.1+ calls lp_accum__.add(normal_log<propto__>(stan::math::abs(y), 0, 1)); whereas 2.17.0 calls lp_accum__.add(normal_log<propto__>(abs(y), 0, 1));

syclik commented 6 years ago

Sorry about that. Can you verify that using the current Stan + Math versions fix this problem. If so, can we close this issue?

Or perhaps add it as a test for compiling if it can cause problems in the future.

On Wed, Jul 11, 2018 at 11:12 PM bgoodri notifications@github.com wrote:

It is not an RStan issue; it is, however, the same Stan Math 2.17.0 issue that has come up several times in the past month. 2.17.1+ calls lp_accum__.add(normal_log(stan::math::abs(y), 0, 1)); whereas 2.17.0 calls

lp_accum__.add(normal_log(abs(y), 0, 1));

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/stan-dev/math/issues/907#issuecomment-404375839, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZ_F-azHXxG9G6VuDiGl4NJumsM8DNHks5uFr6BgaJpZM4UqKNM .

syclik commented 5 years ago

I just verified that it works now with current develop: 6622078887c237a0900d094d40551b6b9abc13fd