示例#1
0
 void print_sample_params(RNG& rng, 
                          stan::mcmc::sample& sample,
                          stan::mcmc::base_mcmc& sampler,
                          M& model) {
   
   if(!_sample_stream) return;
   
   std::vector<double> values;
   
   sample.get_sample_params(values);
   sampler.get_sampler_params(values);
   
   std::vector<double> model_values;
   
   model.write_array(rng,
                     const_cast<std::vector<double>&>(sample.cont_params()),
                     const_cast<std::vector<int>&>(sample.disc_params()),
                     model_values,
                     true, true); // FIXME: add ostream for msgs!
   
   values.insert(values.end(), model_values.begin(), model_values.end());
   
   (*_sample_stream) << values.at(0);
   for (size_t i = 1; i < values.size(); ++i) {
     (*_sample_stream) << "," << values.at(i);
   }
   (*_sample_stream) << std::endl;
   
 }
示例#2
0
      void write_sample_params(RNG& rng,
                               stan::mcmc::sample& sample,
                               stan::mcmc::base_mcmc& sampler,
                               M& model) {
        std::vector<double> values;

        sample.get_sample_params(values);
        sampler.get_sampler_params(values);

        Eigen::VectorXd model_values;

        model.write_array(rng,
                          const_cast<Eigen::VectorXd&>(sample.cont_params()),
                          model_values,
                          true, true,
                          msg_stream_);

        for (int i = 0; i < model_values.size(); ++i)
          values.push_back(model_values(i));

        sample_writer_(values);
      }