void transform_inits(const stan::io::var_context& context__, std::vector<int>& params_i__, std::vector<double>& params_r__, std::ostream* pstream__) const { stan::io::writer<double> writer__(params_r__,params_i__); size_t pos__; (void) pos__; // dummy call to supress warning std::vector<double> vals_r__; std::vector<int> vals_i__; if (!(context__.contains_r("y"))) throw std::runtime_error("variable y missing"); vals_r__ = context__.vals_r("y"); pos__ = 0U; context__.validate_dims("initialization", "y", "double", context__.to_vec()); double y(0); y = vals_r__[pos__++]; try { writer__.scalar_unconstrain(y); } catch (const std::exception& e) { throw std::runtime_error(std::string("Error transforming variable y: ") + e.what()); } params_r__ = writer__.data_r(); params_i__ = writer__.data_i(); }
command_model(stan::io::var_context& context__, std::ostream* pstream__ = 0) : prob_grad::prob_grad(0) { static const char* function__ = "command_model_namespace::command_model(%1%)"; (void) function__; // dummy call to supress warning size_t pos__; (void) pos__; // dummy call to supress warning std::vector<int> vals_i__; std::vector<double> vals_r__; context__.validate_dims("data initialization", "y", "double", context__.to_vec()); y = double(0); vals_r__ = context__.vals_r("y"); pos__ = 0; y = vals_r__[pos__++]; // validate data // validate transformed data set_param_ranges(); }
void transform_inits(const stan::io::var_context& context__, std::vector<int>& params_i__, std::vector<double>& params_r__) const { stan::io::writer<double> writer__(params_r__,params_i__); size_t pos__; std::vector<double> vals_r__; std::vector<int> vals_i__; if (!(context__.contains_r("mu"))) throw std::runtime_error("variable mu missing"); vals_r__ = context__.vals_r("mu"); pos__ = 0U; context__.validate_dims("initialization", "mu", "double", context__.to_vec()); double mu(0); mu = vals_r__[pos__++]; writer__.scalar_unconstrain(mu); params_r__ = writer__.data_r(); params_i__ = writer__.data_i(); }
bernoulli_model(stan::io::var_context& context__, std::ostream* pstream__ = 0) : prob_grad(0) { current_statement_begin__ = -1; static const char* function__ = "bernoulli_model_namespace::bernoulli_model"; (void) function__; // dummy call to supress warning size_t pos__; (void) pos__; // dummy call to supress warning std::vector<int> vals_i__; std::vector<double> vals_r__; context__.validate_dims("data initialization", "N", "int", context__.to_vec()); N = int(0); vals_i__ = context__.vals_i("N"); pos__ = 0; N = vals_i__[pos__++]; context__.validate_dims("data initialization", "y", "int", context__.to_vec(N)); validate_non_negative_index("y", "N", N); y = std::vector<int>(N,int(0)); vals_i__ = context__.vals_i("y"); pos__ = 0; size_t y_limit_0__ = N; for (size_t i_0__ = 0; i_0__ < y_limit_0__; ++i_0__) { y[i_0__] = vals_i__[pos__++]; } // validate data check_greater_or_equal(function__,"N",N,0); for (int k0__ = 0; k0__ < N; ++k0__) { check_greater_or_equal(function__,"y[k0__]",y[k0__],0); check_less_or_equal(function__,"y[k0__]",y[k0__],1); } double DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN()); (void) DUMMY_VAR__; // suppress unused var warning // initialize transformed variables to avoid seg fault on val access try { } catch (const std::exception& e) { stan::lang::rethrow_located(e,current_statement_begin__); // Next line prevents compiler griping about no return throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***"); } // validate transformed data // set parameter ranges num_params_r__ = 0U; param_ranges_i__.clear(); ++num_params_r__; }