1 #ifndef STAN_MATH_PRIM_MAT_FUN_DIVIDE_COLUMNS_HPP 2 #define STAN_MATH_PRIM_MAT_FUN_DIVIDE_COLUMNS_HPP 25 template <
typename T_x,
typename T_v>
26 inline typename std::vector<Eigen::Matrix<
29 const std::vector<T_v> &vec) {
30 const size_t N = x.size();
31 const size_t D = x[0].size();
33 Eigen::Map<const Eigen::Array<T_v, Eigen::Dynamic, 1>> v_vec(&vec[0],
36 std::vector<Eigen::Matrix<typename return_type<T_x, T_v, double>::type,
39 for (
size_t n = 0; n < N; ++n) {
43 out[n] = x[n].array() / v_vec.array();
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.
std::vector< Eigen::Matrix< typename return_type< T_x, T_v, double >::type, Eigen::Dynamic, 1 > > divide_columns(const std::vector< Eigen::Matrix< T_x, Eigen::Dynamic, 1 >> &x, const std::vector< T_v > &vec)
Takes Stan data type vector[n] x[D] and divides column vector in x element-wise by the values in vec...
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.