예제 #1
0
파일: a.cpp 프로젝트: maverickg/toyrpkg
    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();
    }
예제 #2
0
    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();
    }
예제 #3
0
    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();
    }