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>
126Eigen::Matrix<return_type_t<T_shared_param, T_job_param>, Eigen::Dynamic, 1>
128 const std::vector<Eigen::Matrix<T_job_param, Eigen::Dynamic, 1>>&
130 const std::vector<std::vector<double>>& x_r,
131 const std::vector<std::vector<int>>& x_i,
132 std::ostream* msgs =
nullptr) {
133 static constexpr const char* function =
"map_rect";
134 using return_t = Eigen::Matrix<return_type_t<T_shared_param, T_job_param>,
142 const std::vector<int> job_params_dims =
dims(job_params);
144 if (job_params_dims[0] == 0) {
148 const int size_job_params = job_params_dims[1];
149 const int size_x_r =
dims(x_r)[1];
150 const int size_x_i =
dims(x_i)[1];
151 for (
int i = 1; i < job_params_dims[0]; i++) {
153 "Size of one of the vectors of "
154 "the job specific parameters",
155 job_params[i].
size(),
156 "size of another vector of the "
157 "job specific parameters",
160 "Size of one of the arrays of "
161 "the job specific real data",
163 "size of another array of the "
164 "job specific real data",
167 "Size of one of the arrays of "
168 "the job specific int data",
170 "size of another array of the "
171 "job specific int data",
177 T_plain_shared_param shared_params_eval = shared_params;
178 return internal::map_rect_mpi<call_id, F, T_plain_shared_param, T_job_param>(
179 shared_params_eval, job_params, x_r, x_i, msgs);
182 T_shared_param_ref shared_params_ref = shared_params;
184 T_job_param>(shared_params_ref,
185 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 plain_type< T >::type plain_type_t
typename ref_type_if< true, T >::type ref_type_t
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...