Hello people of Stan forum,
I’m relative new to the world of Stan and I been doing some play with Rstan lately. I installed it without problems in Ubuntu 20.04 with the Rstudio interface, and been running some models using the stan function.
Now I’m trying to run rstan using external functions using the stan_model() function to create the model with the option allow_undefined = TRUE and includes=’#include “path/to/my/external/function.hpp”’, as I show you below.
mod <- stan_model(model_code = my_model, allow_undefined = TRUE, includes = '#include "path/to/my/external/function.hpp"' )
My goal is to replicated the results shows in this blog: Using external C++ functions with PyStan & radial velocity exoplanets | Dan Foreman-Mackey
with the documentation provided here: Interfacing with External C++ Code, but when I run the stan_model, It returns me the next error:
Error in compileCode(f, code, language = language, verbose = verbose) :
/home/lientur/R/x86_64-pc-linux-gnu-library/3.6/StanHeaders/include/stan/math/rev/mat/functor/adj_jac_apply.hpp:535:10: required from ‘void stan::math::adj_jac_vari<F, Targs>::chain() [with F = stan::math::internal::softmax_op; Targs = {Eigen::Matrix<stan::math::var, -1, 1, 0, -1, 1>}]’/home/lientur/R/x86_64-pc-linux-gnu-library/3.6/StanHeaders/include/stan/math/rev/mat/functor/adj_jac_apply.hpp:531:8: required from here/home/lientur/R/x86_64-pc-linux-gnu-library/3.6/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:650:34: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits<double>::type’ {aka ‘__vector(2) double’} [-Wignored-attributes] 650 | return internal::first_aligned<int(unpacket_traits<DefaultPacketType>::alignment),Derived>(m); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~make: *** [/usr/lib/R/etc/Makeconf:177: file536f722d08e1.o] Error 1
Error in sink(type = "output") : invalid connection
Any idea of what could be causing this error and how to solve it?
Thank you in advance for any suggestion