1#ifndef STAN_MATH_PRIM_FUNCTOR_MAP_RECT_HPP
2#define STAN_MATH_PRIM_FUNCTOR_MAP_RECT_HPP
9#define STAN_REGISTER_MAP_RECT(CALLID, FUNCTOR)
123template <
int call_id,
typename F,
typename T_shared_param,
124 typename T_job_param,
125 require_eigen_col_vector_t<T_shared_param>* =
nullptr>
126inline Eigen::Matrix<return_type_t<T_shared_param, T_job_param>, Eigen::Dynamic,
129 const std::vector<Eigen::Matrix<T_job_param, Eigen::Dynamic, 1>>&
131 const std::vector<std::vector<double>>& x_r,
132 const std::vector<std::vector<int>>& x_i,
133 std::ostream* msgs =
nullptr) {
134 static constexpr const char* function =
"map_rect";
135 using return_t = Eigen::Matrix<return_type_t<T_shared_param, T_job_param>,
143 const std::vector<int> job_params_dims =
dims(job_params);
145 if (job_params_dims[0] == 0) {
149 const int size_job_params = job_params_dims[1];
150 const int size_x_r =
dims(x_r)[1];
151 const int size_x_i =
dims(x_i)[1];
152 for (
int i = 1; i < job_params_dims[0]; i++) {
154 "Size of one of the vectors of "
155 "the job specific parameters",
156 job_params[i].
size(),
157 "size of another vector of the "
158 "job specific parameters",
161 "Size of one of the arrays of "
162 "the job specific real data",
164 "size of another array of the "
165 "job specific real data",
168 "Size of one of the arrays of "
169 "the job specific int data",
171 "size of another array of the "
172 "job specific int data",
178 T_plain_shared_param shared_params_eval = shared_params;
179 return internal::map_rect_mpi<call_id, F, T_plain_shared_param, T_job_param>(
180 shared_params_eval, job_params, x_r, x_i, msgs);
183 T_shared_param_ref shared_params_ref = shared_params;
185 T_job_param>(shared_params_ref,
186 job_params, x_r, x_i, msgs);
void dims(const T_x &x, std::vector< int > &result)
matrix_cl overload of the dims helper function in prim/fun/dims.hpp.
int64_t size(const T &m)
Returns the size (number of the elements) of a matrix_cl or var_value<matrix_cl<T>>.
Eigen::Matrix< return_type_t< T_shared_param, T_job_param >, Eigen::Dynamic, 1 > map_rect_concurrent(const T_shared_param &shared_params, const std::vector< Eigen::Matrix< T_job_param, Eigen::Dynamic, 1 > > &job_params, const std::vector< std::vector< double > > &x_r, const std::vector< std::vector< int > > &x_i, std::ostream *msgs=nullptr)
void check_matching_sizes(const char *function, const char *name1, const T_y1 &y1, const char *name2, const T_y2 &y2)
Check if two structures at the same size.
Eigen::Matrix< return_type_t< T_shared_param, T_job_param >, Eigen::Dynamic, 1 > map_rect(const T_shared_param &shared_params, const std::vector< Eigen::Matrix< T_job_param, Eigen::Dynamic, 1 > > &job_params, const std::vector< std::vector< double > > &x_r, const std::vector< std::vector< int > > &x_i, std::ostream *msgs=nullptr)
Map N function evaluations to parameters and data which are in rectangular format.
void check_size_match(const char *function, const char *name_i, T_size1 i, const char *name_j, T_size2 j)
Check if the provided sizes match.
typename ref_type_if< true, T >::type ref_type_t
typename plain_type< std::decay_t< T > >::type plain_type_t
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...