1#ifndef STAN_MATH_PRIM_FUN_DIVIDE_COLUMNS_HPP
2#define STAN_MATH_PRIM_FUN_DIVIDE_COLUMNS_HPP
22template <
typename T_x,
typename T_v>
23inline typename std::vector<
24 Eigen::Matrix<return_type_t<T_x, T_v, double>, Eigen::Dynamic, 1>>
26 const std::vector<T_v> &vec) {
27 const size_t N = x.size();
28 const size_t D = x[0].size();
30 Eigen::Map<const Eigen::Array<T_v, Eigen::Dynamic, 1>> v_vec(&vec[0],
33 std::vector<Eigen::Matrix<return_type_t<T_x, T_v, double>, Eigen::Dynamic, 1>>
35 for (
size_t n = 0; n < N; ++n) {
39 out[n] = x[n].array() / v_vec.array();
void divide_columns(matrix_cl< T1 > &A, const matrix_cl< T2 > &B)
Divides each column of a matrix by a vector.
int64_t size(const T &m)
Returns the size (number of the elements) of a matrix_cl or var_value<matrix_cl<T>>.
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.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...