1 #ifndef STAN_MATH_PRIM_MAT_FUNCTOR_MAP_RECT_HPP 2 #define STAN_MATH_PRIM_MAT_FUNCTOR_MAP_RECT_HPP 9 #define STAN_REGISTER_MAP_RECT(CALLID, FUNCTOR) 120 template <
int call_id,
typename F,
typename T_shared_param,
121 typename T_job_param>
122 Eigen::Matrix<typename stan::return_type<T_shared_param, T_job_param>::type,
124 map_rect(
const Eigen::Matrix<T_shared_param, Eigen::Dynamic, 1>& shared_params,
125 const std::vector<Eigen::Matrix<T_job_param, Eigen::Dynamic, 1>>&
127 const std::vector<std::vector<double>>& x_r,
128 const std::vector<std::vector<int>>& x_i,
129 std::ostream* msgs =
nullptr) {
130 static const char*
function =
"map_rect";
131 typedef Eigen::Matrix<
141 const std::vector<int> job_params_dims =
dims(job_params);
142 const int size_job_params = job_params_dims[1];
143 const int size_x_r =
dims(x_r)[1];
144 const int size_x_i =
dims(x_i)[1];
145 for (
int i = 1; i < job_params_dims[0]; i++) {
147 "Size of one of the vectors of " 148 "the job specific parameters",
149 job_params[i].
size(),
150 "size of another vector of the " 151 "job specifc parameters",
154 "Size of one of the arrays of " 155 "the job specific real data",
157 "size of another array of the " 158 "job specifc real data",
161 "Size of one of the arrays of " 162 "the job specific int data",
164 "size of another array of the " 165 "job specifc int data",
169 if (job_params_dims[0] == 0)
173 return internal::map_rect_mpi<call_id, F, T_shared_param, T_job_param>(
174 shared_params, job_params, x_r, x_i, msgs);
176 return internal::map_rect_concurrent<call_id, F, T_shared_param, T_job_param>(
177 shared_params, job_params, x_r, x_i, msgs);
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.
void dims(const T &x, std::vector< int > &result)
boost::math::tools::promote_args< double, typename scalar_type< T >::type, typename return_type< Types_pack... >::type >::type type
int size(const std::vector< T > &x)
Return the size of the specified standard vector.
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< typename stan::return_type< T_shared_param, T_job_param >::type, Eigen::Dynamic, 1 > map_rect(const Eigen::Matrix< T_shared_param, Eigen::Dynamic, 1 > &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.