Ejemplo n.º 1
0
    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();
    }
Ejemplo n.º 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();
    }