Stan  2.10.0
probability, sampling & optimization
write_iteration.hpp
Go to the documentation of this file.
1 #ifndef STAN_SERVICES_IO_WRITE_ITERATION_HPP
2 #define STAN_SERVICES_IO_WRITE_ITERATION_HPP
3 
5 #include <ostream>
6 #include <vector>
7 
8 namespace stan {
9  namespace services {
10  namespace io {
11 
12  template <class Model, class RNG>
13  void write_iteration(Model& model,
14  RNG& base_rng,
15  double lp,
16  std::vector<double>& cont_vector,
17  std::vector<int>& disc_vector,
19  interface_callbacks::writer::base_writer& parameter_writer) {
20  std::vector<double> values;
21  std::stringstream ss;
22  model.write_array(base_rng, cont_vector, disc_vector, values,
23  true, true, &ss);
24  if (ss.str().length() > 0)
25  message_writer(ss.str());
26  values.insert(values.begin(), lp);
27  parameter_writer(values);
28  }
29 
30  }
31  }
32 }
33 
34 #endif
Probability, optimization and sampling library.
void write_iteration(Model &model, RNG &base_rng, double lp, std::vector< double > &cont_vector, std::vector< int > &disc_vector, interface_callbacks::writer::base_writer &message_writer, interface_callbacks::writer::base_writer &parameter_writer)
base_writer is an abstract base class defining the interface for Stan writer callbacks.
Definition: base_writer.hpp:20

     [ Stan Home Page ] © 2011–2016, Stan Development Team.