Skip to content
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

Fail to compile the example from README.rst #18

Open
xsswang opened this issue Jan 29, 2017 · 2 comments
Open

Fail to compile the example from README.rst #18

xsswang opened this issue Jan 29, 2017 · 2 comments

Comments

@xsswang
Copy link

xsswang commented Jan 29, 2017

When put the example into a cpp file, then compiles using "clang++ -I.. -Wall -O2 -std=c++11 test1.cpp -o test1 -larmadillo", it gives:

test1.cpp:59:11: error: no matching constructor for initialization of 'cppbugs::MCModel'
MCModel m(model);
^ ~~~~~
../cppbugs/mcmc.model.hpp:38:9: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from
'std::function<void ()>' to 'const cppbugs::MCModel' for 1st argument
class MCModel {
^
../cppbugs/mcmc.model.hpp:55:5: note: candidate constructor not viable: no known conversion from 'std::function<void ()>' to 'cppbugs::RngBase &'
for 1st argument
MCModel(RngBase& rng): rng_(rng), accepted_(0), rejected_(0), logp_value_(-std::numeric_limits::infinity()), old_logp_value_(-s...
^
1 error generated.

@armstrtw
Copy link
Owner

armstrtw commented Feb 3, 2017

Unfortunately the README file didn't keep up with the changing codebase, I've updated it to display the eight schools model, which is much less complicated than the herd model. Just the core of the model is displayed, so I wouldn't rely on the README to cut/paste the model. Just grab the full version from the 'test' folder where you will also find the other examples. I made a few changes to bring the code up to date with the most recent armadillo I have (7.600.2), so you should be in good shape there.

As much as I liked developing CppBugs, I suggest you check out stan. CppBugs is a very fast random walk sampler, but stan takes a smarter approach to sampling, and I'm in the process of migrating my models.

@xsswang
Copy link
Author

xsswang commented Feb 5, 2017

Great work. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants