Created
June 28, 2016 19:00
-
-
Save mike-lawrence/afddb581b28950f3364578cdbe5e87a2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Last login: Tue Jun 28 15:06:37 on ttys003 | |
Mikes-MacBook-Air:~ mike$ R | |
R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree" | |
Copyright (C) 2015 The R Foundation for Statistical Computing | |
Platform: x86_64-apple-darwin13.4.0 (64-bit) | |
R is free software and comes with ABSOLUTELY NO WARRANTY. | |
You are welcome to redistribute it under certain conditions. | |
Type 'license()' or 'licence()' for distribution details. | |
Natural language support but running in an English locale | |
R is a collaborative project with many contributors. | |
Type 'contributors()' for more information and | |
'citation()' on how to cite R or R packages in publications. | |
Type 'demo()' for some demos, 'help()' for on-line help, or | |
'help.start()' for an HTML browser interface to help. | |
Type 'q()' to quit R. | |
> setwd("~/_/Programming/bayes_days/01_one_group1") | |
> model = rstan::stan_model(file='01_one_group1.stan') | |
In file included from file404625e1dd5.cpp:8: | |
In file included from /Library/Frameworks/R.framework/Versions/3.2/Resources/library/StanHeaders/include/src/stan/model/model_header.hpp:4: | |
In file included from /Library/Frameworks/R.framework/Versions/3.2/Resources/library/StanHeaders/include/stan/math.hpp:4: | |
In file included from /Library/Frameworks/R.framework/Versions/3.2/Resources/library/StanHeaders/include/stan/math/rev/mat.hpp:8: | |
In file included from /Library/Frameworks/R.framework/Versions/3.2/Resources/library/StanHeaders/include/stan/math/prim/mat.hpp:232: | |
In file included from /Library/Frameworks/R.framework/Versions/3.2/Resources/library/StanHeaders/include/stan/math/prim/arr.hpp:33: | |
/Library/Frameworks/R.framework/Versions/3.2/Resources/library/StanHeaders/include/stan/math/prim/arr/functor/integrate_ode_rk45.hpp:81:37: error: no member named 'max_step_checker' in namespace 'boost::numeric::odeint' | |
using boost::numeric::odeint::max_step_checker; | |
~~~~~~~~~~~~~~~~~~~~~~~~^ | |
/Library/Frameworks/R.framework/Versions/3.2/Resources/library/StanHeaders/include/stan/math/prim/arr/functor/integrate_ode_rk45.hpp:136:23: error: use of undeclared identifier 'max_step_checker' | |
max_step_checker(max_num_steps)); | |
^ | |
2 errors generated. | |
make: *** [file404625e1dd5.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.10 | |
7: | |
8: #include <stan/model/model_header.hpp> | |
9: | |
10: namespace model4046f818d37_01_one_group1_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: class model4046f818d37_01_one_group1 : public prob_grad { | |
28: private: | |
29: int nY; | |
30: vector_d Y; | |
31: public: | |
32: model4046f818d37_01_one_group1(stan::io::var_context& context__, | |
33: std::ostream* pstream__ = 0) | |
34: : prob_grad(0) { | |
35: current_statement_begin__ = -1; | |
36: | |
37: static const char* function__ = "model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1"; | |
38: (void) function__; // dummy call to supress warning | |
39: size_t pos__; | |
40: (void) pos__; // dummy call to supress warning | |
41: std::vector<int> vals_i__; | |
42: std::vector<double> vals_r__; | |
43: context__.validate_dims("data initialization", "nY", "int", context__.to_vec()); | |
44: nY = int(0); | |
45: vals_i__ = context__.vals_i("nY"); | |
46: pos__ = 0; | |
47: nY = vals_i__[pos__++]; | |
48: validate_non_negative_index("Y", "nY", nY); | |
49: Y = vector_d(static_cast<Eigen::VectorXd::Index>(nY)); | |
50: context__.validate_dims("data initialization", "Y", "vector_d", context__.to_vec(nY)); | |
51: vals_r__ = context__.vals_r("Y"); | |
52: pos__ = 0; | |
53: size_t Y_i_vec_lim__ = nY; | |
54: for (size_t i_vec__ = 0; i_vec__ < Y_i_vec_lim__; ++i_vec__) { | |
55: Y[i_vec__] = vals_r__[pos__++]; | |
56: } | |
57: | |
58: // validate data | |
59: | |
60: double DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN()); | |
61: (void) DUMMY_VAR__; // suppress unused var warning | |
62: | |
63: | |
64: // initialize transformed variables to avoid seg fault on val access | |
65: | |
66: try { | |
67: } catch (const std::exception& e) { | |
68: stan::lang::rethrow_located(e,current_statement_begin__); | |
69: // Next line prevents compiler griping about no return | |
70: throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); | |
71: } | |
72: | |
73: // validate transformed data | |
74: | |
75: // set parameter ranges | |
76: num_params_r__ = 0U; | |
77: param_ranges_i__.clear(); | |
78: ++num_params_r__; | |
79: } | |
80: | |
81: ~model4046f818d37_01_one_group1() { } | |
82: | |
83: | |
84: void transform_inits(const stan::io::var_context& context__, | |
85: std::vector<int>& params_i__, | |
86: std::vector<double>& params_r__, | |
87: std::ostream* pstream__) const { | |
88: stan::io::writer<double> writer__(params_r__,params_i__); | |
89: size_t pos__; | |
90: (void) pos__; // dummy call to supress warning | |
91: std::vector<double> vals_r__; | |
92: std::vector<int> vals_i__; | |
93: | |
94: if (!(context__.contains_r("mu"))) | |
95: throw std::runtime_error("variable mu missing"); | |
96: vals_r__ = context__.vals_r("mu"); | |
97: pos__ = 0U; | |
98: context__.validate_dims("initialization", "mu", "double", context__.to_vec()); | |
99: double mu(0); | |
100: mu = vals_r__[pos__++]; | |
101: try { | |
102: writer__.scalar_unconstrain(mu); | |
103: } catch (const std::exception& e) { | |
104: throw std::runtime_error(std::string("Error transforming variable mu: ") + e.what()); | |
105: } | |
106: | |
107: params_r__ = writer__.data_r(); | |
108: params_i__ = writer__.data_i(); | |
109: } | |
110: | |
111: void transform_inits(const stan::io::var_context& context, | |
112: Eigen::Matrix<double,Eigen::Dynamic,1>& params_r, | |
113: std::ostream* pstream__) const { | |
114: std::vector<double> params_r_vec; | |
115: std::vector<int> params_i_vec; | |
116: transform_inits(context, params_i_vec, params_r_vec, pstream__); | |
117: params_r.resize(params_r_vec.size()); | |
118: for (int i = 0; i < params_r.size(); ++i) | |
119: params_r(i) = params_r_vec[i]; | |
120: } | |
121: | |
122: | |
123: template <bool propto__, bool jacobian__, typename T__> | |
124: T__ log_prob(vector<T__>& params_r__, | |
125: vector<int>& params_i__, | |
126: std::ostream* pstream__ = 0) const { | |
127: | |
128: T__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN()); | |
129: (void) DUMMY_VAR__; // suppress unused var warning | |
130: | |
131: T__ lp__(0.0); | |
132: stan::math::accumulator<T__> lp_accum__; | |
133: | |
134: // model parameters | |
135: stan::io::reader<T__> in__(params_r__,params_i__); | |
136: | |
137: T__ mu; | |
138: (void) mu; // dummy to suppress unused var warning | |
139: if (jacobian__) | |
140: mu = in__.scalar_constrain(lp__); | |
141: else | |
142: mu = in__.scalar_constrain(); | |
143: | |
144: | |
145: // transformed parameters | |
146: | |
147: // initialize transformed variables to avoid seg fault on val access | |
148: | |
149: try { | |
150: } catch (const std::exception& e) { | |
151: stan::lang::rethrow_located(e,current_statement_begin__); | |
152: // Next line prevents compiler griping about no return | |
153: throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); | |
154: } | |
155: | |
156: // validate transformed parameters | |
157: | |
158: const char* function__ = "validate transformed params"; | |
159: (void) function__; // dummy to suppress unused var warning | |
160: | |
161: // model body | |
162: try { | |
163: current_statement_begin__ = 10; | |
164: lp_accum__.add(normal_log<propto__>(mu, 100, 20)); | |
165: current_statement_begin__ = 11; | |
166: lp_accum__.add(normal_log<propto__>(Y, mu, 15)); | |
167: } catch (const std::exception& e) { | |
168: stan::lang::rethrow_located(e,current_statement_begin__); | |
169: // Next line prevents compiler griping about no return | |
170: throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); | |
171: } | |
172: | |
173: lp_accum__.add(lp__); | |
174: return lp_accum__.sum(); | |
175: | |
176: } // log_prob() | |
177: | |
178: template <bool propto, bool jacobian, typename T_> | |
179: T_ log_prob(Eigen::Matrix<T_,Eigen::Dynamic,1>& params_r, | |
180: std::ostream* pstream = 0) const { | |
181: std::vector<T_> vec_params_r; | |
182: vec_params_r.reserve(params_r.size()); | |
183: for (int i = 0; i < params_r.size(); ++i) | |
184: vec_params_r.push_back(params_r(i)); | |
185: std::vector<int> vec_params_i; | |
186: return log_prob<propto,jacobian,T_>(vec_params_r, vec_params_i, pstream); | |
187: } | |
188: | |
189: | |
190: void get_param_names(std::vector<std::string>& names__) const { | |
191: names__.resize(0); | |
192: names__.push_back("mu"); | |
193: } | |
194: | |
195: | |
196: void get_dims(std::vector<std::vector<size_t> >& dimss__) const { | |
197: dimss__.resize(0); | |
198: std::vector<size_t> dims__; | |
199: dims__.resize(0); | |
200: dimss__.push_back(dims__); | |
201: } | |
202: | |
203: template <typename RNG> | |
204: void write_array(RNG& base_rng__, | |
205: std::vector<double>& params_r__, | |
206: std::vector<int>& params_i__, | |
207: std::vector<double>& vars__, | |
208: bool include_tparams__ = true, | |
209: bool include_gqs__ = true, | |
210: std::ostream* pstream__ = 0) const { | |
211: vars__.resize(0); | |
212: stan::io::reader<double> in__(params_r__,params_i__); | |
213: static const char* function__ = "model4046f818d37_01_one_group1_namespace::write_array"; | |
214: (void) function__; // dummy call to supress warning | |
215: // read-transform, write parameters | |
216: double mu = in__.scalar_constrain(); | |
217: vars__.push_back(mu); | |
218: | |
219: if (!include_tparams__) return; | |
220: // declare and define transformed parameters | |
221: double lp__ = 0.0; | |
222: (void) lp__; // dummy call to supress warning | |
223: stan::math::accumulator<double> lp_accum__; | |
224: | |
225: | |
226: try { | |
227: } catch (const std::exception& e) { | |
228: stan::lang::rethrow_located(e,current_statement_begin__); | |
229: // Next line prevents compiler griping about no return | |
230: throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); | |
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: double DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN()); | |
241: (void) DUMMY_VAR__; // suppress unused var warning | |
242: | |
243: | |
244: // initialize transformed variables to avoid seg fault on val access | |
245: | |
246: try { | |
247: } catch (const std::exception& e) { | |
248: stan::lang::rethrow_located(e,current_statement_begin__); | |
249: // Next line prevents compiler griping about no return | |
250: throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); | |
251: } | |
252: | |
253: // validate generated quantities | |
254: | |
255: // write generated quantities | |
256: } | |
257: | |
258: template <typename RNG> | |
259: void write_array(RNG& base_rng, | |
260: Eigen::Matrix<double,Eigen::Dynamic,1>& params_r, | |
261: Eigen::Matrix<double,Eigen::Dynamic,1>& vars, | |
262: bool include_tparams = true, | |
263: bool include_gqs = true, | |
264: std::ostream* pstream = 0) const { | |
265: std::vector<double> params_r_vec(params_r.size()); | |
266: for (int i = 0; i < params_r.size(); ++i) | |
267: params_r_vec[i] = params_r(i); | |
268: std::vector<double> vars_vec; | |
269: std::vector<int> params_i_vec; | |
270: write_array(base_rng,params_r_vec,params_i_vec,vars_vec,include_tparams,include_gqs,pstream); | |
271: vars.resize(vars_vec.size()); | |
272: for (int i = 0; i < vars.size(); ++i) | |
273: vars(i) = vars_vec[i]; | |
274: } | |
275: | |
276: static std::string model_name() { | |
277: return "model4046f818d37_01_one_group1"; | |
278: } | |
279: | |
280: | |
281: void constrained_param_names(std::vector<std::string>& param_names__, | |
282: bool include_tparams__ = true, | |
283: bool include_gqs__ = true) const { | |
284: std::stringstream param_name_stream__; | |
285: param_name_stream__.str(std::string()); | |
286: param_name_stream__ << "mu"; | |
287: param_names__.push_back(param_name_stream__.str()); | |
288: | |
289: if (!include_gqs__ && !include_tparams__) return; | |
290: | |
291: if (!include_gqs__) return; | |
292: } | |
293: | |
294: | |
295: void unconstrained_param_names(std::vector<std::string>& param_names__, | |
296: bool include_tparams__ = true, | |
297: bool include_gqs__ = true) const { | |
298: std::stringstream param_name_stream__; | |
299: param_name_stream__.str(std::string()); | |
300: param_name_stream__ << "mu"; | |
301: param_names__.push_back(param_name_stream__.str()); | |
302: | |
303: if (!include_gqs__ && !include_tparams__) return; | |
304: | |
305: if (!include_gqs__) return; | |
306: } | |
307: | |
308: }; // model | |
309: | |
310: } // namespace | |
311: | |
312: typedef model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1 stan_model; | |
313: | |
314: #include <rstan/rstaninc.hpp> | |
315: /** | |
316: * Define Rcpp Module to expose stan_fit's functions to R. | |
317: */ | |
318: RCPP_MODULE(stan_fit4model4046f818d37_01_one_group1_mod){ | |
319: Rcpp::class_<rstan::stan_fit<model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1, | |
320: boost::random::ecuyer1988> >("stan_fit4model4046f818d37_01_one_group1") | |
321: // .constructor<Rcpp::List>() | |
322: .constructor<SEXP, SEXP>() | |
323: // .constructor<SEXP, SEXP>() | |
324: .method("call_sampler", | |
325: &rstan::stan_fit<model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1, boost::random::ecuyer1988>::call_sampler) | |
326: .method("param_names", | |
327: &rstan::stan_fit<model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1, boost::random::ecuyer1988>::param_names) | |
328: .method("param_names_oi", | |
329: &rstan::stan_fit<model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1, boost::random::ecuyer1988>::param_names_oi) | |
330: .method("param_fnames_oi", | |
331: &rstan::stan_fit<model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1, boost::random::ecuyer1988>::param_fnames_oi) | |
332: .method("param_dims", | |
333: &rstan::stan_fit<model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1, boost::random::ecuyer1988>::param_dims) | |
334: .method("param_dims_oi", | |
335: &rstan::stan_fit<model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1, boost::random::ecuyer1988>::param_dims_oi) | |
336: .method("update_param_oi", | |
337: &rstan::stan_fit<model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1, boost::random::ecuyer1988>::update_param_oi) | |
338: .method("param_oi_tidx", | |
339: &rstan::stan_fit<model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1, boost::random::ecuyer1988>::param_oi_tidx) | |
340: .method("grad_log_prob", | |
341: &rstan::stan_fit<model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1, boost::random::ecuyer1988>::grad_log_prob) | |
342: .method("log_prob", | |
343: &rstan::stan_fit<model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1, boost::random::ecuyer1988>::log_prob) | |
344: .method("unconstrain_pars", | |
345: &rstan::stan_fit<model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1, boost::random::ecuyer1988>::unconstrain_pars) | |
346: .method("constrain_pars", | |
347: &rstan::stan_fit<model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1, boost::random::ecuyer1988>::constrain_pars) | |
348: .method("num_pars_unconstrained", | |
349: &rstan::stan_fit<model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1, boost::random::ecuyer1988>::num_pars_unconstrained) | |
350: .method("unconstrained_param_names", | |
351: &rstan::stan_fit<model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1, boost::random::ecuyer1988>::unconstrained_param_names) | |
352: .method("constrained_param_names", | |
353: &rstan::stan_fit<model4046f818d37_01_one_group1_namespace::model4046f818d37_01_one_group1, boost::random::ecuyer1988>::constrained_param_names) | |
354: ; | |
355: } | |
356: | |
357: // declarations | |
358: extern "C" { | |
359: SEXP file404625e1dd5( ) ; | |
360: } | |
361: | |
362: // definition | |
363: | |
364: SEXP file404625e1dd5( ){ | |
365: return Rcpp::wrap("01_one_group1"); | |
366: } | |
367: | |
368: | |
Error in compileCode(f, code, language = language, verbose = verbose) : | |
Compilation ERROR, function(s)/method(s) not created! In file included from file404625e1dd5.cpp:8: | |
In file included from /Library/Frameworks/R.framework/Versions/3.2/Resources/library/StanHeaders/include/src/stan/model/model_header.hpp:4: | |
In file included from /Library/Frameworks/R.framework/Versions/3.2/Resources/library/StanHeaders/include/stan/math.hpp:4: | |
In file included from /Library/Frameworks/R.framework/Versions/3.2/Resources/library/StanHeaders/include/stan/math/rev/mat.hpp:8: | |
In file included from /Library/Frameworks/R.framework/Versions/3.2/Resources/library/StanHeaders/include/stan/math/prim/mat.hpp:232: | |
In file included from /Library/Frameworks/R.framework/Versions/3.2/Resources/library/StanHeaders/include/stan/math/prim/arr.hpp:33: | |
/Library/Frameworks/R.framework/Versions/3.2/Resources/library/StanHeaders/include/stan/math/prim/arr/functor/integrate_ode_rk45.hpp:81:37: error: no member named 'max_step_checker' in namespace 'boost::numeric::odeint' | |
using bo | |
In addition: Warning message: | |
running command '/Library/Frameworks/R.framework/Resources/bin/R CMD SHLIB file404625e1dd5.cpp 2> file404625e1dd5.cpp.err.txt' had status 1 | |
> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment