-
-
Notifications
You must be signed in to change notification settings - Fork 372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compilation errors related with stan::math::arena_matrix #3085
Comments
@crespofabian8012: Thanks for reporting. That's definitely a bug in Stan---you shouldn't ever see C++ compilation errors. Can you share the Stan program that led to this error (the shorter, the better)? |
Hey Fabian, I am guessing this a continuation of this discussion.
Based on the fact you are using Eigen 3.4, I am guessing you are using your own system-installed libraries? Is there a specific need to use Eigen 3.4? Stan currently uses 3.3.9 and that is also the version we test with in our CI. You can see which libraries are bundled with Stan here: https://github.com/stan-dev/math/tree/develop/lib
Errors like this typically mean that Eigen was included ahead of Stan headers. Stan Math is tightly coupled with Eigen in that we add code to the Eigen:: namespace. The adj() member function is one of those additions. The header file that must be included first is I would recommend you check out one of the top-level tests in Stan, for example https://github.com/stan-dev/stan/blob/develop/src/test/unit/services/sample/hmc_nuts_unit_e_adapt_test.cpp and try to run it and observe how the test is compiled. Then use that as a shim to compile your own C++ program (you can obviously then remove the GTest includes that are used for the test only). I am moving this to the Stan repository, as that is where this issue should live, as its about using plain C++ Stan. |
Thanks @bob-carpenter and @rok-cesnovar. Yes, I am having the same issue with /examples/bernoulli.stan when translated with stanc. I am using Eigen 3.4, because I use some new features in Eigen 3.4 like Eigen::SeqN( for even and odd positions). |
Probably the easiest workaround is to just include There is also a branch in Stan Math |
Until we bump to 3.4 I would not use it. There's a lot that has changed internally in eigen and we have to update a good bit for that |
fwiw, I fixed this in my project by making sure #include <stan/math.hpp> cam before any #include <Eigen/ lines |
Hello
I translated a stan model using stanc3(CMDSTAN 2.28.1). I included the .hpp file in Xcode(MacOSX Mojave). I have Eigen 3.4 installed, Sundials, Boost , TBB 2020.3
I am getting compilation errors:
No member named 'adj' in 'stan::math::arena_matrix<Eigen::Matrix<stan::math::var_value<double, void>, -1, 1, 0, -1, 1> >'
No member named 'val' in 'stan::math::arena_matrix<Eigen::Matrix<stan::math::var_value<double, void>, -1, 1, 0, -1, 1> >'
The text was updated successfully, but these errors were encountered: