1#ifndef STAN_MATH_PRIM_FUN_ELT_DIVIDE_HPP
2#define STAN_MATH_PRIM_FUN_ELT_DIVIDE_HPP
22template <
typename Mat1,
typename Mat2,
23 require_all_eigen_t<Mat1, Mat2>* =
nullptr,
24 require_all_not_st_var<Mat1, Mat2>* =
nullptr>
28 [&](
auto&& m1_,
auto&& m2_) {
29 return (m1_.array() / m2_.array()).matrix();
31 std::forward<Mat1>(m1), std::forward<Mat2>(m2));
45template <
typename Mat,
typename Scal, require_matrix_t<Mat>* =
nullptr,
46 require_stan_scalar_t<Scal>* =
nullptr>
48 return divide(std::forward<Mat>(m), s);
62template <
typename Scal,
typename Mat, require_stan_scalar_t<Scal>* =
nullptr,
63 require_eigen_t<Mat>* =
nullptr>
65 return make_holder([s](
auto&& m_) {
return (s / m_.array()).matrix(); },
66 std::forward<Mat>(m));
69template <
typename Scal1,
typename Scal2,
elt_divide_< as_operation_cl_t< T_a >, as_operation_cl_t< T_b > > elt_divide(T_a &&a, T_b &&b)
auto divide(T_a &&a, double d)
Returns the elementwise division of the kernel generator expression.
require_all_t< is_stan_scalar< std::decay_t< Types > >... > require_all_stan_scalar_t
Require all of the types satisfy is_stan_scalar.
void check_matching_dims(const char *function, const char *name1, const T1 &y1, const char *name2, const T2 &y2)
Check if the two containers have the same dimensions.
auto make_holder(F &&func, Args &&... args)
Calls given function with given arguments.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...