1 #ifndef STAN_MATH_REV_MAT_FUNCTOR_MAP_RECT_REDUCE_HPP 2 #define STAN_MATH_REV_MAT_FUNCTOR_MAP_RECT_REDUCE_HPP 20 const std::vector<double>& x_r,
21 const std::vector<int>& x_i,
22 std::ostream*
msgs =
nullptr)
const {
23 const size_type num_shared_params = shared_params.rows();
24 const size_type num_job_specific_params = job_specific_params.rows();
25 matrix_d out(1 + num_shared_params + num_job_specific_params, 0);
33 =
F()(shared_params_v, job_specific_params_v, x_r, x_i,
msgs);
37 out.resize(Eigen::NoChange, size_f);
40 out(0,
i) = fx_v(
i).val();
44 out(1 +
j,
i) = shared_params_v(
j).vi_->adj_;
46 out(1 + num_shared_params +
j,
i)
47 = job_specific_params_v(
j).vi_->adj_;
62 const std::vector<double>& x_r,
63 const std::vector<int>& x_i,
64 std::ostream*
msgs =
nullptr)
const {
65 const size_type num_job_specific_params = job_specific_params.rows();
72 vector_v fx_v =
F()(shared_params, job_specific_params_v, x_r, x_i,
msgs);
76 out.resize(Eigen::NoChange, size_f);
79 out(0,
i) = fx_v(
i).val();
83 out(1 +
j,
i) = job_specific_params_v(
j).vi_->adj_;
98 const std::vector<double>& x_r,
99 const std::vector<int>& x_i,
100 std::ostream*
msgs =
nullptr)
const {
101 const size_type num_shared_params = shared_params.rows();
108 vector_v fx_v =
F()(shared_params_v, job_specific_params, x_r, x_i,
msgs);
112 out.resize(Eigen::NoChange, size_f);
115 out(0,
i) = fx_v(
i).val();
119 out(1 +
j,
i) = shared_params_v(
j).vi_->adj_;
134 #ifdef STAN_REGISTER_MPI_MAP_RECT_ALL 136 #undef STAN_REGISTER_MPI_MAP_RECT_ALL 138 #define STAN_REGISTER_MPI_MAP_RECT_ALL(CALLID, FUNCTOR) \ 139 STAN_REGISTER_MPI_MAP_RECT(CALLID, FUNCTOR, double, double) \ 140 STAN_REGISTER_MPI_MAP_RECT(CALLID, FUNCTOR, double, var) \ 141 STAN_REGISTER_MPI_MAP_RECT(CALLID, FUNCTOR, var, double) \ 142 STAN_REGISTER_MPI_MAP_RECT(CALLID, FUNCTOR, var, var)
Eigen::Matrix< var, Eigen::Dynamic, 1 > vector_v
Eigen::Matrix< double, Eigen::Dynamic, 1 > vector_d
static void set_zero_all_adjoints_nested()
matrix_d operator()(const vector_d &shared_params, const vector_d &job_specific_params, const std::vector< double > &x_r, const std::vector< int > &x_i, std::ostream *msgs=nullptr) const
::xsd::cxx::tree::exception< char > exception
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic >::Index size_type
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > matrix_d
matrix_d operator()(const vector_d &shared_params, const vector_d &job_specific_params, const std::vector< double > &x_r, const std::vector< int > &x_i, std::ostream *msgs=nullptr) const
matrix_d operator()(const vector_d &shared_params, const vector_d &job_specific_params, const std::vector< double > &x_r, const std::vector< int > &x_i, std::ostream *msgs=nullptr) const
static void recover_memory_nested()
std::vector< var > to_var(const std::vector< double > &v)
static void start_nested()