Last active
July 9, 2020 16:58
-
-
Save cdriveraus/404dd12ebaf1abc9f6a75fdbcbeb688b to your computer and use it in GitHub Desktop.
This file contains 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
stn_md> stancode <- 'data {real y_mean;} parameters {real y;} model {y ~ normal(y_mean,1);}' | |
stn_md> mod <- stan_model(model_code = stancode, verbose = TRUE) | |
TRANSLATING MODEL '73fc79f8b1915e8208c736914c86d1a1' FROM Stan CODE TO C++ CODE NOW. | |
successful in parsing the Stan model '73fc79f8b1915e8208c736914c86d1a1'. | |
The NEXT version of Stan will not be able to pre-process your Stan program. | |
Please open an issue at | |
https://github.com/stan-dev/stanc3/issues | |
if you can share or at least describe your Stan program. This will help ensure that Stan | |
continues to work on your Stan programs in the future. Thank you! | |
This message can be avoided by wrapping your function call inside suppressMessages(). | |
COMPILING THE C++ CODE FOR MODEL '73fc79f8b1915e8208c736914c86d1a1' NOW. | |
OS: x86_64, mingw32; rstan: 2.21.1; Rcpp: 1.0.5; inline: 0.3.15 | |
>> setting environment variables: | |
PKG_LIBS = C:/Users/Driver/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a -L"C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/libs/x64" -lStanHeaders -L"C:/Users/Driver/Documents/R/win-library/4.0/RcppParallel/lib/x64" -ltbb | |
PKG_CPPFLAGS = -I"C:/Users/Driver/Documents/R/win-library/4.0/Rcpp/include/" -I"C:/Users/Driver/Documents/R/win-library/4.0/RcppEigen/include/" -I"C:/Users/Driver/Documents/R/win-library/4.0/RcppEigen/include/unsupported" -I"C:/Users/Driver/Documents/R/win-library/4.0/BH/include" -I"C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/src/" -I"C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/" -I"C:/Users/Driver/Documents/R/win-library/4.0/RcppParallel/include/" -I"C:/Users/Driver/Documents/R/win-library/4.0/rstan/include" -DEIGEN_NO_DEBUG -DBOOST_DISABLE_ASSERTS -DBOOST_PENDING_INTEGER_LOG2_HPP -DSTAN_THREADS -DBOOST_NO_AUTO_PTR -include "C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp" -std=c++1y | |
>> Program source : | |
1 : | |
2 : // includes from the plugin | |
3 : // [[Rcpp::plugins(cpp14)]] | |
4 : | |
5 : | |
6 : // user includes | |
7 : #include <Rcpp.h> | |
8 : #include <rstan/io/rlist_ref_var_context.hpp> | |
9 : #include <rstan/io/r_ostream.hpp> | |
10 : #include <rstan/stan_args.hpp> | |
11 : #include <boost/integer/integer_log2.hpp> | |
12 : // Code generated by Stan version 2.21.0 | |
13 : | |
14 : #include <stan/model/model_header.hpp> | |
15 : | |
16 : namespace model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1_namespace { | |
17 : | |
18 : using std::istream; | |
19 : using std::string; | |
20 : using std::stringstream; | |
21 : using std::vector; | |
22 : using stan::io::dump; | |
23 : using stan::math::lgamma; | |
24 : using stan::model::prob_grad; | |
25 : using namespace stan::math; | |
26 : | |
27 : static int current_statement_begin__; | |
28 : | |
29 : stan::io::program_reader prog_reader__() { | |
30 : stan::io::program_reader reader; | |
31 : reader.add_event(0, 0, "start", "model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1"); | |
32 : reader.add_event(3, 1, "end", "model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1"); | |
33 : return reader; | |
34 : } | |
35 : | |
36 : class model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1 | |
37 : : public stan::model::model_base_crtp<model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1> { | |
38 : private: | |
39 : double y_mean; | |
40 : public: | |
41 : model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1(rstan::io::rlist_ref_var_context& context__, | |
42 : std::ostream* pstream__ = 0) | |
43 : : model_base_crtp(0) { | |
44 : ctor_body(context__, 0, pstream__); | |
45 : } | |
46 : | |
47 : model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1(stan::io::var_context& context__, | |
48 : unsigned int random_seed__, | |
49 : std::ostream* pstream__ = 0) | |
50 : : model_base_crtp(0) { | |
51 : ctor_body(context__, random_seed__, pstream__); | |
52 : } | |
53 : | |
54 : void ctor_body(stan::io::var_context& context__, | |
55 : unsigned int random_seed__, | |
56 : std::ostream* pstream__) { | |
57 : typedef double local_scalar_t__; | |
58 : | |
59 : boost::ecuyer1988 base_rng__ = | |
60 : stan::services::util::create_rng(random_seed__, 0); | |
61 : (void) base_rng__; // suppress unused var warning | |
62 : | |
63 : current_statement_begin__ = -1; | |
64 : | |
65 : static const char* function__ = "model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1_namespace::model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1"; | |
66 : (void) function__; // dummy to suppress unused var warning | |
67 : size_t pos__; | |
68 : (void) pos__; // dummy to suppress unused var warning | |
69 : std::vector<int> vals_i__; | |
70 : std::vector<double> vals_r__; | |
71 : local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN()); | |
72 : (void) DUMMY_VAR__; // suppress unused var warning | |
73 : | |
74 : try { | |
75 : // initialize data block variables from context__ | |
76 : current_statement_begin__ = 1; | |
77 : context__.validate_dims("data initialization", "y_mean", "double", context__.to_vec()); | |
78 : y_mean = double(0); | |
79 : vals_r__ = context__.vals_r("y_mean"); | |
80 : pos__ = 0; | |
81 : y_mean = vals_r__[pos__++]; | |
82 : | |
83 : | |
84 : // initialize transformed data variables | |
85 : // execute transformed data statements | |
86 : | |
87 : // validate transformed data | |
88 : | |
89 : // validate, set parameter ranges | |
90 : num_params_r__ = 0U; | |
91 : param_ranges_i__.clear(); | |
92 : current_statement_begin__ = 1; | |
93 : num_params_r__ += 1; | |
94 : } catch (const std::exception& e) { | |
95 : stan::lang::rethrow_located(e, current_statement_begin__, prog_reader__()); | |
96 : // Next line prevents compiler griping about no return | |
97 : throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); | |
98 : } | |
99 : } | |
100 : | |
101 : ~model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1() { } | |
102 : | |
103 : | |
104 : void transform_inits(const stan::io::var_context& context__, | |
105 : std::vector<int>& params_i__, | |
106 : std::vector<double>& params_r__, | |
107 : std::ostream* pstream__) const { | |
108 : typedef double local_scalar_t__; | |
109 : stan::io::writer<double> writer__(params_r__, params_i__); | |
110 : size_t pos__; | |
111 : (void) pos__; // dummy call to supress warning | |
112 : std::vector<double> vals_r__; | |
113 : std::vector<int> vals_i__; | |
114 : | |
115 : current_statement_begin__ = 1; | |
116 : if (!(context__.contains_r("y"))) | |
117 : stan::lang::rethrow_located(std::runtime_error(std::string("Variable y missing")), current_statement_begin__, prog_reader__()); | |
118 : vals_r__ = context__.vals_r("y"); | |
119 : pos__ = 0U; | |
120 : context__.validate_dims("parameter initialization", "y", "double", context__.to_vec()); | |
121 : double y(0); | |
122 : y = vals_r__[pos__++]; | |
123 : try { | |
124 : writer__.scalar_unconstrain(y); | |
125 : } catch (const std::exception& e) { | |
126 : stan::lang::rethrow_located(std::runtime_error(std::string("Error transforming variable y: ") + e.what()), current_statement_begin__, prog_reader__()); | |
127 : } | |
128 : | |
129 : params_r__ = writer__.data_r(); | |
130 : params_i__ = writer__.data_i(); | |
131 : } | |
132 : | |
133 : void transform_inits(const stan::io::var_context& context, | |
134 : Eigen::Matrix<double, Eigen::Dynamic, 1>& params_r, | |
135 : std::ostream* pstream__) const { | |
136 : std::vector<double> params_r_vec; | |
137 : std::vector<int> params_i_vec; | |
138 : transform_inits(context, params_i_vec, params_r_vec, pstream__); | |
139 : params_r.resize(params_r_vec.size()); | |
140 : for (int i = 0; i < params_r.size(); ++i) | |
141 : params_r(i) = params_r_vec[i]; | |
142 : } | |
143 : | |
144 : | |
145 : template <bool propto__, bool jacobian__, typename T__> | |
146 : T__ log_prob(std::vector<T__>& params_r__, | |
147 : std::vector<int>& params_i__, | |
148 : std::ostream* pstream__ = 0) const { | |
149 : | |
150 : typedef T__ local_scalar_t__; | |
151 : | |
152 : local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN()); | |
153 : (void) DUMMY_VAR__; // dummy to suppress unused var warning | |
154 : | |
155 : T__ lp__(0.0); | |
156 : stan::math::accumulator<T__> lp_accum__; | |
157 : try { | |
158 : stan::io::reader<local_scalar_t__> in__(params_r__, params_i__); | |
159 : | |
160 : // model parameters | |
161 : current_statement_begin__ = 1; | |
162 : local_scalar_t__ y; | |
163 : (void) y; // dummy to suppress unused var warning | |
164 : if (jacobian__) | |
165 : y = in__.scalar_constrain(lp__); | |
166 : else | |
167 : y = in__.scalar_constrain(); | |
168 : | |
169 : // model body | |
170 : | |
171 : current_statement_begin__ = 1; | |
172 : lp_accum__.add(normal_log<propto__>(y, y_mean, 1)); | |
173 : | |
174 : } catch (const std::exception& e) { | |
175 : stan::lang::rethrow_located(e, current_statement_begin__, prog_reader__()); | |
176 : // Next line prevents compiler griping about no return | |
177 : throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); | |
178 : } | |
179 : | |
180 : lp_accum__.add(lp__); | |
181 : return lp_accum__.sum(); | |
182 : | |
183 : } // log_prob() | |
184 : | |
185 : template <bool propto, bool jacobian, typename T_> | |
186 : T_ log_prob(Eigen::Matrix<T_,Eigen::Dynamic,1>& params_r, | |
187 : std::ostream* pstream = 0) const { | |
188 : std::vector<T_> vec_params_r; | |
189 : vec_params_r.reserve(params_r.size()); | |
190 : for (int i = 0; i < params_r.size(); ++i) | |
191 : vec_params_r.push_back(params_r(i)); | |
192 : std::vector<int> vec_params_i; | |
193 : return log_prob<propto,jacobian,T_>(vec_params_r, vec_params_i, pstream); | |
194 : } | |
195 : | |
196 : | |
197 : void get_param_names(std::vector<std::string>& names__) const { | |
198 : names__.resize(0); | |
199 : names__.push_back("y"); | |
200 : } | |
201 : | |
202 : | |
203 : void get_dims(std::vector<std::vector<size_t> >& dimss__) const { | |
204 : dimss__.resize(0); | |
205 : std::vector<size_t> dims__; | |
206 : dims__.resize(0); | |
207 : dimss__.push_back(dims__); | |
208 : } | |
209 : | |
210 : template <typename RNG> | |
211 : void write_array(RNG& base_rng__, | |
212 : std::vector<double>& params_r__, | |
213 : std::vector<int>& params_i__, | |
214 : std::vector<double>& vars__, | |
215 : bool include_tparams__ = true, | |
216 : bool include_gqs__ = true, | |
217 : std::ostream* pstream__ = 0) const { | |
218 : typedef double local_scalar_t__; | |
219 : | |
220 : vars__.resize(0); | |
221 : stan::io::reader<local_scalar_t__> in__(params_r__, params_i__); | |
222 : static const char* function__ = "model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1_namespace::write_array"; | |
223 : (void) function__; // dummy to suppress unused var warning | |
224 : | |
225 : // read-transform, write parameters | |
226 : double y = in__.scalar_constrain(); | |
227 : vars__.push_back(y); | |
228 : | |
229 : double lp__ = 0.0; | |
230 : (void) lp__; // dummy to suppress unused var warning | |
231 : stan::math::accumulator<double> lp_accum__; | |
232 : | |
233 : local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN()); | |
234 : (void) DUMMY_VAR__; // suppress unused var warning | |
235 : | |
236 : if (!include_tparams__ && !include_gqs__) return; | |
237 : | |
238 : try { | |
239 : if (!include_gqs__ && !include_tparams__) return; | |
240 : if (!include_gqs__) return; | |
241 : } catch (const std::exception& e) { | |
242 : stan::lang::rethrow_located(e, current_statement_begin__, prog_reader__()); | |
243 : // Next line prevents compiler griping about no return | |
244 : throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); | |
245 : } | |
246 : } | |
247 : | |
248 : template <typename RNG> | |
249 : void write_array(RNG& base_rng, | |
250 : Eigen::Matrix<double,Eigen::Dynamic,1>& params_r, | |
251 : Eigen::Matrix<double,Eigen::Dynamic,1>& vars, | |
252 : bool include_tparams = true, | |
253 : bool include_gqs = true, | |
254 : std::ostream* pstream = 0) const { | |
255 : std::vector<double> params_r_vec(params_r.size()); | |
256 : for (int i = 0; i < params_r.size(); ++i) | |
257 : params_r_vec[i] = params_r(i); | |
258 : std::vector<double> vars_vec; | |
259 : std::vector<int> params_i_vec; | |
260 : write_array(base_rng, params_r_vec, params_i_vec, vars_vec, include_tparams, include_gqs, pstream); | |
261 : vars.resize(vars_vec.size()); | |
262 : for (int i = 0; i < vars.size(); ++i) | |
263 : vars(i) = vars_vec[i]; | |
264 : } | |
265 : | |
266 : std::string model_name() const { | |
267 : return "model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1"; | |
268 : } | |
269 : | |
270 : | |
271 : void constrained_param_names(std::vector<std::string>& param_names__, | |
272 : bool include_tparams__ = true, | |
273 : bool include_gqs__ = true) const { | |
274 : std::stringstream param_name_stream__; | |
275 : param_name_stream__.str(std::string()); | |
276 : param_name_stream__ << "y"; | |
277 : param_names__.push_back(param_name_stream__.str()); | |
278 : | |
279 : if (!include_gqs__ && !include_tparams__) return; | |
280 : | |
281 : if (include_tparams__) { | |
282 : } | |
283 : | |
284 : if (!include_gqs__) return; | |
285 : } | |
286 : | |
287 : | |
288 : void unconstrained_param_names(std::vector<std::string>& param_names__, | |
289 : bool include_tparams__ = true, | |
290 : bool include_gqs__ = true) const { | |
291 : std::stringstream param_name_stream__; | |
292 : param_name_stream__.str(std::string()); | |
293 : param_name_stream__ << "y"; | |
294 : param_names__.push_back(param_name_stream__.str()); | |
295 : | |
296 : if (!include_gqs__ && !include_tparams__) return; | |
297 : | |
298 : if (include_tparams__) { | |
299 : } | |
300 : | |
301 : if (!include_gqs__) return; | |
302 : } | |
303 : | |
304 : }; // model | |
305 : | |
306 : } // namespace | |
307 : | |
308 : typedef model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1_namespace::model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1 stan_model; | |
309 : | |
310 : #ifndef USING_R | |
311 : | |
312 : stan::model::model_base& new_model( | |
313 : stan::io::var_context& data_context, | |
314 : unsigned int seed, | |
315 : std::ostream* msg_stream) { | |
316 : stan_model* m = new stan_model(data_context, seed, msg_stream); | |
317 : return *m; | |
318 : } | |
319 : | |
320 : #endif | |
321 : | |
322 : | |
323 : | |
324 : #include <rstan_next/stan_fit.hpp> | |
325 : | |
326 : struct stan_model_holder { | |
327 : stan_model_holder(rstan::io::rlist_ref_var_context rcontext, | |
328 : unsigned int random_seed) | |
329 : : rcontext_(rcontext), random_seed_(random_seed) | |
330 : { | |
331 : } | |
332 : | |
333 : //stan::math::ChainableStack ad_stack; | |
334 : rstan::io::rlist_ref_var_context rcontext_; | |
335 : unsigned int random_seed_; | |
336 : }; | |
337 : | |
338 : Rcpp::XPtr<stan::model::model_base> model_ptr(stan_model_holder* smh) { | |
339 : Rcpp::XPtr<stan::model::model_base> model_instance(new stan_model(smh->rcontext_, smh->random_seed_), true); | |
340 : return model_instance; | |
341 : } | |
342 : | |
343 : Rcpp::XPtr<rstan::stan_fit_base> fit_ptr(stan_model_holder* smh) { | |
344 : return Rcpp::XPtr<rstan::stan_fit_base>(new rstan::stan_fit(model_ptr(smh), smh->random_seed_), true); | |
345 : } | |
346 : | |
347 : std::string model_name(stan_model_holder* smh) { | |
348 : return model_ptr(smh).get()->model_name(); | |
349 : } | |
350 : | |
351 : RCPP_MODULE(stan_fit4model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1_mod){ | |
352 : Rcpp::class_<stan_model_holder>("stan_fit4model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1") | |
353 : .constructor<rstan::io::rlist_ref_var_context, unsigned int>() | |
354 : .method("model_ptr", &model_ptr) | |
355 : .method("fit_ptr", &fit_ptr) | |
356 : .method("model_name", &model_name) | |
357 : ; | |
358 : } | |
359 : | |
360 : | |
361 : // declarations | |
362 : extern "C" { | |
363 : SEXP file31847a87a11( ) ; | |
364 : } | |
365 : | |
366 : // definition | |
367 : | |
368 : SEXP file31847a87a11( ){ | |
369 : return Rcpp::wrap("73fc79f8b1915e8208c736914c86d1a1"); | |
370 : } | |
371 : | |
372 : | |
Compilation argument: | |
C:/PROGRA~1/R/R-4.0.2/bin/x64/R CMD SHLIB file31847a87a11.cpp 2> file31847a87a11.cpp.err.txt | |
"C:/rtools40/mingw64/bin/"g++ -std=gnu++14 -I"C:/PROGRA~1/R/R-4.0.2/include" -DNDEBUG -I"C:/Users/Driver/Documents/R/win-library/4.0/Rcpp/include/" -I"C:/Users/Driver/Documents/R/win-library/4.0/RcppEigen/include/" -I"C:/Users/Driver/Documents/R/win-library/4.0/RcppEigen/include/unsupported" -I"C:/Users/Driver/Documents/R/win-library/4.0/BH/include" -I"C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/src/" -I"C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/" -I"C:/Users/Driver/Documents/R/win-library/4.0/RcppParallel/include/" -I"C:/Users/Driver/Documents/R/win-library/4.0/rstan/include" -DEIGEN_NO_DEBUG -DBOOST_DISABLE_ASSERTS -DBOOST_PENDING_INTEGER_LOG2_HPP -DSTAN_THREADS -DBOOST_NO_AUTO_PTR -include "C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp" -std=c++1y -Wno-ignored-attributes -march=core2 -include C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp -I "C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include" -I "C:/Users/Driver/Documents/R/win-library/4.0/RcppEigen/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -O3 -mtune=native -march=native -O3 -mtune=native -march=native -c file31847a87a11.cpp -o file31847a87a11.o | |
In file included from C:/Users/Driver/Documents/R/win-library/4.0/BH/include/boost/mpl/aux_/na_assert.hpp:23, | |
from C:/Users/Driver/Documents/R/win-library/4.0/BH/include/boost/mpl/arg.hpp:25, | |
from C:/Users/Driver/Documents/R/win-library/4.0/BH/include/boost/mpl/placeholders.hpp:24, | |
from C:/Users/Driver/Documents/R/win-library/4.0/BH/include/boost/iterator/iterator_categories.hpp:16, | |
from C:/Users/Driver/Documents/R/win-library/4.0/BH/include/boost/iterator/iterator_facade.hpp:13, | |
from C:/Users/Driver/Documents/R/win-library/4.0/BH/include/boost/range/iterator_range_core.hpp:27, | |
from C:/Users/Driver/Documents/R/win-library/4.0/BH/include/boost/lexical_cast.hpp:30, | |
from C:/Users/Driver/Documents/R/win-library/4.0/rstan/include/rstan/stan_args.hpp:12, | |
from file31847a87a11.cpp:10: | |
C:/Users/Driver/Documents/R/win-library/4.0/BH/include/boost/mpl/assert.hpp:194:21: warning: unnecessary parentheses in declaration of 'assert_arg' [-Wparentheses] | |
failed ************ (Pred::************ | |
^ | |
C:/Users/Driver/Documents/R/win-library/4.0/BH/include/boost/mpl/assert.hpp:199:21: warning: unnecessary parentheses in declaration of 'assert_not_arg' [-Wparentheses] | |
failed ************ (boost::mpl::not_<Pred>::************ | |
^ | |
In file included from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat/prob/dirichlet_log.hpp:5, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat.hpp:278, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/mat.hpp:12, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math.hpp:4, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/src/stan/model/model_header.hpp:4, | |
from file31847a87a11.cpp:14: | |
C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat/prob/dirichlet_lpmf.hpp: In function 'stan::return_type_t<T1, T2> stan::math::dirichlet_lpmf(const T_prob&, const T_prior_size&)': | |
C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat/prob/dirichlet_lpmf.hpp:60:74: warning: typedef 'using T_partials_vec = struct Eigen::Matrix<typename stan::partials_return_type<T_prob, T_prior_size>::type, -1, 1>' locally defined but not used [-Wunused-local-typedefs] | |
using T_partials_vec = typename Eigen::Matrix<T_partials_return, -1, 1>; | |
^ | |
In file included from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat/prob/poisson_log_glm_log.hpp:5, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat.hpp:328, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/mat.hpp:12, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math.hpp:4, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/src/stan/model/model_header.hpp:4, | |
from file31847a87a11.cpp:14: | |
C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat/prob/poisson_log_glm_lpmf.hpp: In function 'stan::return_type_t<T_x, T_alpha, T_beta> stan::math::poisson_log_glm_lpmf(const T_y&, const T_x&, const T_alpha&, const T_beta&)': | |
C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat/prob/poisson_log_glm_lpmf.hpp:55:34: warning: typedef 'using T_alpha_val = std::conditional_t<stan::is_vector<T4>::value, Eigen::Array<typename stan::partials_return_type<T_alpha>::type, -1, 1>, typename stan::partials_return_type<T_alpha>::type>' locally defined but not used [-Wunused-local-typedefs] | |
partials_return_t<T_alpha>>; | |
^ | |
In file included from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/mat.hpp:51, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math.hpp:4, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/src/stan/model/model_header.hpp:4, | |
from file31847a87a11.cpp:14: | |
C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/mat/fun/squared_distance.hpp: In static member function 'static double stan::math::internal::squared_distance_vv_vari::var_squared_distance(const Eigen::Matrix<stan::math::var, R, C>&, const Eigen::Matrix<stan::math::var, R2, C2, (AutoAlign | (((R2 == 1) && (C2 != 1)) ? RowMajor : (((C2 == 1) && (R2 != 1)) ? ColMajor : ColMajor))), R2, C2>&)': | |
C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/mat/fun/squared_distance.hpp:27:54: warning: typedef 'using idx_t = using type = Eigen::EigenBase<Eigen::Matrix<stan::math::var, -1, -1> >::Index' locally defined but not used [-Wunused-local-typedefs] | |
using idx_t = typename index_type<matrix_v>::type; | |
^ | |
C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/mat/fun/squared_distance.hpp: In static member function 'static double stan::math::internal::squared_distance_vd_vari::var_squared_distance(const Eigen::Matrix<stan::math::var, R, C>&, const Eigen::Matrix<double, R2, C2>&)': | |
C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/mat/fun/squared_distance.hpp:64:54: warning: typedef 'using idx_t = using type = Eigen::EigenBase<Eigen::Matrix<double, -1, -1> >::Index' locally defined but not used [-Wunused-local-typedefs] | |
using idx_t = typename index_type<matrix_d>::type; | |
^ | |
In file included from C:/Users/Driver/Documents/R/win-library/4.0/RcppParallel/include/tbb/parallel_for.h:25, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/mat/functor/map_rect_concurrent.hpp:12, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/mat.hpp:73, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math.hpp:4, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/src/stan/model/model_header.hpp:4, | |
from file31847a87a11.cpp:14: | |
C:/Users/Driver/Documents/R/win-library/4.0/RcppParallel/include/tbb/task.h: At global scope: | |
C:/Users/Driver/Documents/R/win-library/4.0/RcppParallel/include/tbb/task.h:1008:84: warning: optimization attribute on 'void* operator new(size_t, const tbb::internal::allocate_root_proxy&)' follows definition but the attribute doesn't match [-Wattributes] | |
inline void *operator new( size_t bytes, const tbb::internal::allocate_root_proxy& ) { | |
^ | |
In file included from C:/Users/Driver/Documents/R/win-library/4.0/RcppEigen/include/Eigen/Core:82, | |
from C:/Users/Driver/Documents/R/win-library/4.0/RcppEigen/include/Eigen/Dense:1, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13, | |
from <command-line>: | |
C:/rtools40/mingw64/include/c++/8.3.0/new:168:14: note: previous definition of 'void* operator new(std::size_t, void*)' was here | |
inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT | |
^~~~~~~~ | |
In file included from C:/Users/Driver/Documents/R/win-library/4.0/RcppParallel/include/tbb/parallel_for.h:25, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/mat/functor/map_rect_concurrent.hpp:12, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/mat.hpp:73, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math.hpp:4, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/src/stan/model/model_header.hpp:4, | |
from file31847a87a11.cpp:14: | |
C:/Users/Driver/Documents/R/win-library/4.0/RcppParallel/include/tbb/task.h:1012:84: warning: optimization attribute on 'void operator delete(void*, const tbb::internal::allocate_root_proxy&)' follows definition but the attribute doesn't match [-Wattributes] | |
inline void operator delete( void* task, const tbb::internal::allocate_root_proxy& ) { | |
^ | |
In file included from C:/Users/Driver/Documents/R/win-library/4.0/RcppEigen/include/Eigen/Core:82, | |
from C:/Users/Driver/Documents/R/win-library/4.0/RcppEigen/include/Eigen/Dense:1, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13, | |
from <command-line>: | |
C:/rtools40/mingw64/include/c++/8.3.0/new:174:13: note: previous definition of 'void operator delete(void*, void*)' was here | |
inline void operator delete (void*, void*) _GLIBCXX_USE_NOEXCEPT { } | |
^~~~~~~~ | |
In file included from C:/Users/Driver/Documents/R/win-library/4.0/RcppParallel/include/tbb/parallel_for.h:25, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/mat/functor/map_rect_concurrent.hpp:12, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/mat.hpp:73, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math.hpp:4, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/src/stan/model/model_header.hpp:4, | |
from file31847a87a11.cpp:14: | |
C:/Users/Driver/Documents/R/win-library/4.0/RcppParallel/include/tbb/task.h:1017:99: warning: optimization attribute on 'void* operator new(size_t, const tbb::internal::allocate_root_with_context_proxy&)' follows definition but the attribute doesn't match [-Wattributes] | |
inline void *operator new( size_t bytes, const tbb::internal::allocate_root_with_context_proxy& p ) { | |
^ | |
In file included from C:/Users/Driver/Documents/R/win-library/4.0/RcppEigen/include/Eigen/Core:82, | |
from C:/Users/Driver/Documents/R/win-library/4.0/RcppEigen/include/Eigen/Dense:1, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13, | |
from <command-line>: | |
C:/rtools40/mingw64/include/c++/8.3.0/new:168:14: note: previous definition of 'void* operator new(std::size_t, void*)' was here | |
inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT | |
^~~~~~~~ | |
In file included from C:/Users/Driver/Documents/R/win-library/4.0/RcppParallel/include/tbb/parallel_for.h:25, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/mat/functor/map_rect_concurrent.hpp:12, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/mat.hpp:73, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math.hpp:4, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/src/stan/model/model_header.hpp:4, | |
from file31847a87a11.cpp:14: | |
C:/Users/Driver/Documents/R/win-library/4.0/RcppParallel/include/tbb/task.h:1021:99: warning: optimization attribute on 'void operator delete(void*, const tbb::internal::allocate_root_with_context_proxy&)' follows definition but the attribute doesn't match [-Wattributes] | |
inline void operator delete( void* task, const tbb::internal::allocate_root_with_context_proxy& p ) { | |
^ | |
In file included from C:/Users/Driver/Documents/R/win-library/4.0/RcppEigen/include/Eigen/Core:82, | |
from C:/Users/Driver/Documents/R/win-library/4.0/RcppEigen/include/Eigen/Dense:1, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13, | |
from <command-line>: | |
C:/rtools40/mingw64/include/c++/8.3.0/new:174:13: note: previous definition of 'void operator delete(void*, void*)' was here | |
inline void operator delete (void*, void*) _GLIBCXX_USE_NOEXCEPT { } | |
^~~~~~~~ | |
In file included from C:/Users/Driver/Documents/R/win-library/4.0/RcppParallel/include/tbb/parallel_for.h:25, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/mat/functor/map_rect_concurrent.hpp:12, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/mat.hpp:73, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math.hpp:4, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/src/stan/model/model_header.hpp:4, | |
from file31847a87a11.cpp:14: | |
C:/Users/Driver/Documents/R/win-library/4.0/RcppParallel/include/tbb/task.h:1026:94: warning: optimization attribute on 'void* operator new(size_t, const tbb::internal::allocate_continuation_proxy&)' follows definition but the attribute doesn't match [-Wattributes] | |
inline void *operator new( size_t bytes, const tbb::internal::allocate_continuation_proxy& p ) { | |
^ | |
In file included from C:/Users/Driver/Documents/R/win-library/4.0/RcppEigen/include/Eigen/Core:82, | |
from C:/Users/Driver/Documents/R/win-library/4.0/RcppEigen/include/Eigen/Dense:1, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13, | |
from <command-line>: | |
C:/rtools40/mingw64/include/c++/8.3.0/new:168:14: note: previous definition of 'void* operator new(std::size_t, void*)' was here | |
inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT | |
^~~~~~~~ | |
In file included from C:/Users/Driver/Documents/R/win-library/4.0/RcppParallel/include/tbb/parallel_for.h:25, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/mat/functor/map_rect_concurrent.hpp:12, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/mat.hpp:73, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math.hpp:4, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/src/stan/model/model_header.hpp:4, | |
from file31847a87a11.cpp:14: | |
C:/Users/Driver/Documents/R/win-library/4.0/RcppParallel/include/tbb/task.h:1030:94: warning: optimization attribute on 'void operator delete(void*, const tbb::internal::allocate_continuation_proxy&)' follows definition but the attribute doesn't match [-Wattributes] | |
inline void operator delete( void* task, const tbb::internal::allocate_continuation_proxy& p ) { | |
^ | |
In file included from C:/Users/Driver/Documents/R/win-library/4.0/RcppEigen/include/Eigen/Core:82, | |
from C:/Users/Driver/Documents/R/win-library/4.0/RcppEigen/include/Eigen/Dense:1, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13, | |
from <command-line>: | |
C:/rtools40/mingw64/include/c++/8.3.0/new:174:13: note: previous definition of 'void operator delete(void*, void*)' was here | |
inline void operator delete (void*, void*) _GLIBCXX_USE_NOEXCEPT { } | |
^~~~~~~~ | |
In file included from C:/Users/Driver/Documents/R/win-library/4.0/RcppParallel/include/tbb/parallel_for.h:25, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/mat/functor/map_rect_concurrent.hpp:12, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/mat.hpp:73, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math.hpp:4, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/src/stan/model/model_header.hpp:4, | |
from file31847a87a11.cpp:14: | |
C:/Users/Driver/Documents/R/win-library/4.0/RcppParallel/include/tbb/task.h:1034:87: warning: optimization attribute on 'void* operator new(size_t, const tbb::internal::allocate_child_proxy&)' follows definition but the attribute doesn't match [-Wattributes] | |
inline void *operator new( size_t bytes, const tbb::internal::allocate_child_proxy& p ) { | |
^ | |
In file included from C:/Users/Driver/Documents/R/win-library/4.0/RcppEigen/include/Eigen/Core:82, | |
from C:/Users/Driver/Documents/R/win-library/4.0/RcppEigen/include/Eigen/Dense:1, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13, | |
from <command-line>: | |
C:/rtools40/mingw64/include/c++/8.3.0/new:168:14: note: previous definition of 'void* operator new(std::size_t, void*)' was here | |
inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT | |
^~~~~~~~ | |
In file included from C:/Users/Driver/Documents/R/win-library/4.0/RcppParallel/include/tbb/parallel_for.h:25, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/mat/functor/map_rect_concurrent.hpp:12, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/mat.hpp:73, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math.hpp:4, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/src/stan/model/model_header.hpp:4, | |
from file31847a87a11.cpp:14: | |
C:/Users/Driver/Documents/R/win-library/4.0/RcppParallel/include/tbb/task.h:1038:87: warning: optimization attribute on 'void operator delete(void*, const tbb::internal::allocate_child_proxy&)' follows definition but the attribute doesn't match [-Wattributes] | |
inline void operator delete( void* task, const tbb::internal::allocate_child_proxy& p ) { | |
^ | |
In file included from C:/Users/Driver/Documents/R/win-library/4.0/RcppEigen/include/Eigen/Core:82, | |
from C:/Users/Driver/Documents/R/win-library/4.0/RcppEigen/include/Eigen/Dense:1, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13, | |
from <command-line>: | |
C:/rtools40/mingw64/include/c++/8.3.0/new:174:13: note: previous definition of 'void operator delete(void*, void*)' was here | |
inline void operator delete (void*, void*) _GLIBCXX_USE_NOEXCEPT { } | |
^~~~~~~~ | |
In file included from C:/Users/Driver/Documents/R/win-library/4.0/RcppParallel/include/tbb/parallel_for.h:25, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/mat/functor/map_rect_concurrent.hpp:12, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/mat.hpp:73, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math.hpp:4, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/src/stan/model/model_header.hpp:4, | |
from file31847a87a11.cpp:14: | |
C:/Users/Driver/Documents/R/win-library/4.0/RcppParallel/include/tbb/task.h:1042:101: warning: optimization attribute on 'void* operator new(size_t, const tbb::internal::allocate_additional_child_of_proxy&)' follows definition but the attribute doesn't match [-Wattributes] | |
inline void *operator new( size_t bytes, const tbb::internal::allocate_additional_child_of_proxy& p ) { | |
^ | |
In file included from C:/Users/Driver/Documents/R/win-library/4.0/RcppEigen/include/Eigen/Core:82, | |
from C:/Users/Driver/Documents/R/win-library/4.0/RcppEigen/include/Eigen/Dense:1, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13, | |
from <command-line>: | |
C:/rtools40/mingw64/include/c++/8.3.0/new:168:14: note: previous definition of 'void* operator new(std::size_t, void*)' was here | |
inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT | |
^~~~~~~~ | |
In file included from C:/Users/Driver/Documents/R/win-library/4.0/RcppParallel/include/tbb/parallel_for.h:25, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/mat/functor/map_rect_concurrent.hpp:12, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/mat.hpp:73, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math.hpp:4, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/src/stan/model/model_header.hpp:4, | |
from file31847a87a11.cpp:14: | |
C:/Users/Driver/Documents/R/win-library/4.0/RcppParallel/include/tbb/task.h:1046:101: warning: optimization attribute on 'void operator delete(void*, const tbb::internal::allocate_additional_child_of_proxy&)' follows definition but the attribute doesn't match [-Wattributes] | |
inline void operator delete( void* task, const tbb::internal::allocate_additional_child_of_proxy& p ) { | |
^ | |
In file included from C:/Users/Driver/Documents/R/win-library/4.0/RcppEigen/include/Eigen/Core:82, | |
from C:/Users/Driver/Documents/R/win-library/4.0/RcppEigen/include/Eigen/Dense:1, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13, | |
from <command-line>: | |
C:/rtools40/mingw64/include/c++/8.3.0/new:174:13: note: previous definition of 'void operator delete(void*, void*)' was here | |
inline void operator delete (void*, void*) _GLIBCXX_USE_NOEXCEPT { } | |
^~~~~~~~ | |
file31847a87a11.cpp: In member function 'virtual void model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1_namespace::model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1::transform_inits(const stan::io::var_context&, std::vector<int>&, std::vector<double>&, std::ostream*) const': | |
file31847a87a11.cpp:108:24: warning: typedef 'local_scalar_t__' locally defined but not used [-Wunused-local-typedefs] | |
typedef double local_scalar_t__; | |
^~~~~~~~~~~~~~~~ | |
In file included from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/core.hpp:46, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/mat.hpp:6, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math.hpp:4, | |
from C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/src/stan/model/model_header.hpp:4, | |
from file31847a87a11.cpp:14: | |
C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/core/set_zero_all_adjoints.hpp: At global scope: | |
C:/Users/Driver/Documents/R/win-library/4.0/StanHeaders/include/stan/math/rev/core/set_zero_all_adjoints.hpp:14:13: warning: 'void stan::math::set_zero_all_adjoints()' defined but not used [-Wunused-function] | |
static void set_zero_all_adjoints() { | |
^~~~~~~~~~~~~~~~~~~~~ | |
C:/rtools40/mingw64/bin/g++ -shared -s -static-libgcc -o file31847a87a11.dll tmp.def file31847a87a11.o C:/R/win-library/4.0/rstan/lib/x64/libStanServices.a -L C:/R/win-library/4.0/StanHeaders/libs/x64 -lStanHeaders -L C:/R/win-library/4.0/RcppParallel/lib/x64 -ltbb -LC:/PROGRA~1/R/R-4.0.2/bin/x64 -lR | |
g++.exe: error: C:/R/win-library/4.0/rstan/lib/x64/libStanServices.a: No such file or directory | |
ERROR(s) during compilation: source code errors or compiler configuration errors! | |
Program source: | |
1: | |
2: // includes from the plugin | |
3: // [[Rcpp::plugins(cpp14)]] | |
4: | |
5: | |
6: // user includes | |
7: #include <Rcpp.h> | |
8: #include <rstan/io/rlist_ref_var_context.hpp> | |
9: #include <rstan/io/r_ostream.hpp> | |
10: #include <rstan/stan_args.hpp> | |
11: #include <boost/integer/integer_log2.hpp> | |
12: // Code generated by Stan version 2.21.0 | |
13: | |
14: #include <stan/model/model_header.hpp> | |
15: | |
16: namespace model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1_namespace { | |
17: | |
18: using std::istream; | |
19: using std::string; | |
20: using std::stringstream; | |
21: using std::vector; | |
22: using stan::io::dump; | |
23: using stan::math::lgamma; | |
24: using stan::model::prob_grad; | |
25: using namespace stan::math; | |
26: | |
27: static int current_statement_begin__; | |
28: | |
29: stan::io::program_reader prog_reader__() { | |
30: stan::io::program_reader reader; | |
31: reader.add_event(0, 0, "start", "model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1"); | |
32: reader.add_event(3, 1, "end", "model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1"); | |
33: return reader; | |
34: } | |
35: | |
36: class model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1 | |
37: : public stan::model::model_base_crtp<model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1> { | |
38: private: | |
39: double y_mean; | |
40: public: | |
41: model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1(rstan::io::rlist_ref_var_context& context__, | |
42: std::ostream* pstream__ = 0) | |
43: : model_base_crtp(0) { | |
44: ctor_body(context__, 0, pstream__); | |
45: } | |
46: | |
47: model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1(stan::io::var_context& context__, | |
48: unsigned int random_seed__, | |
49: std::ostream* pstream__ = 0) | |
50: : model_base_crtp(0) { | |
51: ctor_body(context__, random_seed__, pstream__); | |
52: } | |
53: | |
54: void ctor_body(stan::io::var_context& context__, | |
55: unsigned int random_seed__, | |
56: std::ostream* pstream__) { | |
57: typedef double local_scalar_t__; | |
58: | |
59: boost::ecuyer1988 base_rng__ = | |
60: stan::services::util::create_rng(random_seed__, 0); | |
61: (void) base_rng__; // suppress unused var warning | |
62: | |
63: current_statement_begin__ = -1; | |
64: | |
65: static const char* function__ = "model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1_namespace::model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1"; | |
66: (void) function__; // dummy to suppress unused var warning | |
67: size_t pos__; | |
68: (void) pos__; // dummy to suppress unused var warning | |
69: std::vector<int> vals_i__; | |
70: std::vector<double> vals_r__; | |
71: local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN()); | |
72: (void) DUMMY_VAR__; // suppress unused var warning | |
73: | |
74: try { | |
75: // initialize data block variables from context__ | |
76: current_statement_begin__ = 1; | |
77: context__.validate_dims("data initialization", "y_mean", "double", context__.to_vec()); | |
78: y_mean = double(0); | |
79: vals_r__ = context__.vals_r("y_mean"); | |
80: pos__ = 0; | |
81: y_mean = vals_r__[pos__++]; | |
82: | |
83: | |
84: // initialize transformed data variables | |
85: // execute transformed data statements | |
86: | |
87: // validate transformed data | |
88: | |
89: // validate, set parameter ranges | |
90: num_params_r__ = 0U; | |
91: param_ranges_i__.clear(); | |
92: current_statement_begin__ = 1; | |
93: num_params_r__ += 1; | |
94: } catch (const std::exception& e) { | |
95: stan::lang::rethrow_located(e, current_statement_begin__, prog_reader__()); | |
96: // Next line prevents compiler griping about no return | |
97: throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); | |
98: } | |
99: } | |
100: | |
101: ~model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1() { } | |
102: | |
103: | |
104: void transform_inits(const stan::io::var_context& context__, | |
105: std::vector<int>& params_i__, | |
106: std::vector<double>& params_r__, | |
107: std::ostream* pstream__) const { | |
108: typedef double local_scalar_t__; | |
109: stan::io::writer<double> writer__(params_r__, params_i__); | |
110: size_t pos__; | |
111: (void) pos__; // dummy call to supress warning | |
112: std::vector<double> vals_r__; | |
113: std::vector<int> vals_i__; | |
114: | |
115: current_statement_begin__ = 1; | |
116: if (!(context__.contains_r("y"))) | |
117: stan::lang::rethrow_located(std::runtime_error(std::string("Variable y missing")), current_statement_begin__, prog_reader__()); | |
118: vals_r__ = context__.vals_r("y"); | |
119: pos__ = 0U; | |
120: context__.validate_dims("parameter initialization", "y", "double", context__.to_vec()); | |
121: double y(0); | |
122: y = vals_r__[pos__++]; | |
123: try { | |
124: writer__.scalar_unconstrain(y); | |
125: } catch (const std::exception& e) { | |
126: stan::lang::rethrow_located(std::runtime_error(std::string("Error transforming variable y: ") + e.what()), current_statement_begin__, prog_reader__()); | |
127: } | |
128: | |
129: params_r__ = writer__.data_r(); | |
130: params_i__ = writer__.data_i(); | |
131: } | |
132: | |
133: void transform_inits(const stan::io::var_context& context, | |
134: Eigen::Matrix<double, Eigen::Dynamic, 1>& params_r, | |
135: std::ostream* pstream__) const { | |
136: std::vector<double> params_r_vec; | |
137: std::vector<int> params_i_vec; | |
138: transform_inits(context, params_i_vec, params_r_vec, pstream__); | |
139: params_r.resize(params_r_vec.size()); | |
140: for (int i = 0; i < params_r.size(); ++i) | |
141: params_r(i) = params_r_vec[i]; | |
142: } | |
143: | |
144: | |
145: template <bool propto__, bool jacobian__, typename T__> | |
146: T__ log_prob(std::vector<T__>& params_r__, | |
147: std::vector<int>& params_i__, | |
148: std::ostream* pstream__ = 0) const { | |
149: | |
150: typedef T__ local_scalar_t__; | |
151: | |
152: local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN()); | |
153: (void) DUMMY_VAR__; // dummy to suppress unused var warning | |
154: | |
155: T__ lp__(0.0); | |
156: stan::math::accumulator<T__> lp_accum__; | |
157: try { | |
158: stan::io::reader<local_scalar_t__> in__(params_r__, params_i__); | |
159: | |
160: // model parameters | |
161: current_statement_begin__ = 1; | |
162: local_scalar_t__ y; | |
163: (void) y; // dummy to suppress unused var warning | |
164: if (jacobian__) | |
165: y = in__.scalar_constrain(lp__); | |
166: else | |
167: y = in__.scalar_constrain(); | |
168: | |
169: // model body | |
170: | |
171: current_statement_begin__ = 1; | |
172: lp_accum__.add(normal_log<propto__>(y, y_mean, 1)); | |
173: | |
174: } catch (const std::exception& e) { | |
175: stan::lang::rethrow_located(e, current_statement_begin__, prog_reader__()); | |
176: // Next line prevents compiler griping about no return | |
177: throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); | |
178: } | |
179: | |
180: lp_accum__.add(lp__); | |
181: return lp_accum__.sum(); | |
182: | |
183: } // log_prob() | |
184: | |
185: template <bool propto, bool jacobian, typename T_> | |
186: T_ log_prob(Eigen::Matrix<T_,Eigen::Dynamic,1>& params_r, | |
187: std::ostream* pstream = 0) const { | |
188: std::vector<T_> vec_params_r; | |
189: vec_params_r.reserve(params_r.size()); | |
190: for (int i = 0; i < params_r.size(); ++i) | |
191: vec_params_r.push_back(params_r(i)); | |
192: std::vector<int> vec_params_i; | |
193: return log_prob<propto,jacobian,T_>(vec_params_r, vec_params_i, pstream); | |
194: } | |
195: | |
196: | |
197: void get_param_names(std::vector<std::string>& names__) const { | |
198: names__.resize(0); | |
199: names__.push_back("y"); | |
200: } | |
201: | |
202: | |
203: void get_dims(std::vector<std::vector<size_t> >& dimss__) const { | |
204: dimss__.resize(0); | |
205: std::vector<size_t> dims__; | |
206: dims__.resize(0); | |
207: dimss__.push_back(dims__); | |
208: } | |
209: | |
210: template <typename RNG> | |
211: void write_array(RNG& base_rng__, | |
212: std::vector<double>& params_r__, | |
213: std::vector<int>& params_i__, | |
214: std::vector<double>& vars__, | |
215: bool include_tparams__ = true, | |
216: bool include_gqs__ = true, | |
217: std::ostream* pstream__ = 0) const { | |
218: typedef double local_scalar_t__; | |
219: | |
220: vars__.resize(0); | |
221: stan::io::reader<local_scalar_t__> in__(params_r__, params_i__); | |
222: static const char* function__ = "model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1_namespace::write_array"; | |
223: (void) function__; // dummy to suppress unused var warning | |
224: | |
225: // read-transform, write parameters | |
226: double y = in__.scalar_constrain(); | |
227: vars__.push_back(y); | |
228: | |
229: double lp__ = 0.0; | |
230: (void) lp__; // dummy to suppress unused var warning | |
231: stan::math::accumulator<double> lp_accum__; | |
232: | |
233: local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN()); | |
234: (void) DUMMY_VAR__; // suppress unused var warning | |
235: | |
236: if (!include_tparams__ && !include_gqs__) return; | |
237: | |
238: try { | |
239: if (!include_gqs__ && !include_tparams__) return; | |
240: if (!include_gqs__) return; | |
241: } catch (const std::exception& e) { | |
242: stan::lang::rethrow_located(e, current_statement_begin__, prog_reader__()); | |
243: // Next line prevents compiler griping about no return | |
244: throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); | |
245: } | |
246: } | |
247: | |
248: template <typename RNG> | |
249: void write_array(RNG& base_rng, | |
250: Eigen::Matrix<double,Eigen::Dynamic,1>& params_r, | |
251: Eigen::Matrix<double,Eigen::Dynamic,1>& vars, | |
252: bool include_tparams = true, | |
253: bool include_gqs = true, | |
254: std::ostream* pstream = 0) const { | |
255: std::vector<double> params_r_vec(params_r.size()); | |
256: for (int i = 0; i < params_r.size(); ++i) | |
257: params_r_vec[i] = params_r(i); | |
258: std::vector<double> vars_vec; | |
259: std::vector<int> params_i_vec; | |
260: write_array(base_rng, params_r_vec, params_i_vec, vars_vec, include_tparams, include_gqs, pstream); | |
261: vars.resize(vars_vec.size()); | |
262: for (int i = 0; i < vars.size(); ++i) | |
263: vars(i) = vars_vec[i]; | |
264: } | |
265: | |
266: std::string model_name() const { | |
267: return "model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1"; | |
268: } | |
269: | |
270: | |
271: void constrained_param_names(std::vector<std::string>& param_names__, | |
272: bool include_tparams__ = true, | |
273: bool include_gqs__ = true) const { | |
274: std::stringstream param_name_stream__; | |
275: param_name_stream__.str(std::string()); | |
276: param_name_stream__ << "y"; | |
277: param_names__.push_back(param_name_stream__.str()); | |
278: | |
279: if (!include_gqs__ && !include_tparams__) return; | |
280: | |
281: if (include_tparams__) { | |
282: } | |
283: | |
284: if (!include_gqs__) return; | |
285: } | |
286: | |
287: | |
288: void unconstrained_param_names(std::vector<std::string>& param_names__, | |
289: bool include_tparams__ = true, | |
290: bool include_gqs__ = true) const { | |
291: std::stringstream param_name_stream__; | |
292: param_name_stream__.str(std::string()); | |
293: param_name_stream__ << "y"; | |
294: param_names__.push_back(param_name_stream__.str()); | |
295: | |
296: if (!include_gqs__ && !include_tparams__) return; | |
297: | |
298: if (include_tparams__) { | |
299: } | |
300: | |
301: if (!include_gqs__) return; | |
302: } | |
303: | |
304: }; // model | |
305: | |
306: } // namespace | |
307: | |
308: typedef model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1_namespace::model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1 stan_model; | |
309: | |
310: #ifndef USING_R | |
311: | |
312: stan::model::model_base& new_model( | |
313: stan::io::var_context& data_context, | |
314: unsigned int seed, | |
315: std::ostream* msg_stream) { | |
316: stan_model* m = new stan_model(data_context, seed, msg_stream); | |
317: return *m; | |
318: } | |
319: | |
320: #endif | |
321: | |
322: | |
323: | |
324: #include <rstan_next/stan_fit.hpp> | |
325: | |
326: struct stan_model_holder { | |
327: stan_model_holder(rstan::io::rlist_ref_var_context rcontext, | |
328: unsigned int random_seed) | |
329: : rcontext_(rcontext), random_seed_(random_seed) | |
330: { | |
331: } | |
332: | |
333: //stan::math::ChainableStack ad_stack; | |
334: rstan::io::rlist_ref_var_context rcontext_; | |
335: unsigned int random_seed_; | |
336: }; | |
337: | |
338: Rcpp::XPtr<stan::model::model_base> model_ptr(stan_model_holder* smh) { | |
339: Rcpp::XPtr<stan::model::model_base> model_instance(new stan_model(smh->rcontext_, smh->random_seed_), true); | |
340: return model_instance; | |
341: } | |
342: | |
343: Rcpp::XPtr<rstan::stan_fit_base> fit_ptr(stan_model_holder* smh) { | |
344: return Rcpp::XPtr<rstan::stan_fit_base>(new rstan::stan_fit(model_ptr(smh), smh->random_seed_), true); | |
345: } | |
346: | |
347: std::string model_name(stan_model_holder* smh) { | |
348: return model_ptr(smh).get()->model_name(); | |
349: } | |
350: | |
351: RCPP_MODULE(stan_fit4model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1_mod){ | |
352: Rcpp::class_<stan_model_holder>("stan_fit4model318427ee1d69_73fc79f8b1915e8208c736914c86d1a1") | |
353: .constructor<rstan::io::rlist_ref_var_context, unsigned int>() | |
354: .method("model_ptr", &model_ptr) | |
355: .method("fit_ptr", &fit_ptr) | |
356: .method("model_name", &model_name) | |
357: ; | |
358: } | |
359: | |
360: | |
361: // declarations | |
362: extern "C" { | |
363: SEXP file31847a87a11( ) ; | |
364: } | |
365: | |
366: // definition | |
367: | |
368: SEXP file31847a87a11( ){ | |
369: return Rcpp::wrap("73fc79f8b1915e8208c736914c86d1a1"); | |
370: } | |
371: | |
372: | |
Error in compileCode(f, code, language = language, verbose = verbose) : | |
Compilation ERROR, function(s)/method(s) not created! g++.exe: error: C:/R/win-library/4.0/rstan/lib/x64/libStanServices.a: No such file or directory | |
In addition: Warning message: | |
In file.remove(c(unprocessed, processed)) : | |
cannot remove file 'C:\Users\Driver\AppData\Local\Temp\RtmpiGVSW3\file3184ba179db.stan', reason 'No such file or directory' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment