<commit_before>#ifndef STAN_MATH_PRIM_MAT_FUN_ELT_DIVIDE_HPP
#define STAN_MATH_PRIM_MAT_FUN_ELT_DIVIDE_HPP

#include <boost/math/tools/promotion.hpp>
#include <stan/math/prim/mat/fun/Eigen.hpp>
#include <stan/math/prim/mat/err/check_matching_dims.hpp>

namespace stan {
namespace math {

/**
 * Return the elementwise division of the specified matrices.
 *
 * @tparam T1 Type of scalars in first matrix.
 * @tparam T2 Type of scalars in second matrix.
 * @tparam R Row type of both matrices.
 * @tparam C Column type of both matrices.
 * @param m1 First matrix
 * @param m2 Second matrix
 * @return Elementwise division of matrices.
 */
template <typename T1, typename T2, int R, int C>
Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type, R, C>
elt_divide(const Eigen::Matrix<T1, R, C>& m1,
           const Eigen::Matrix<T2, R, C>& m2) {
  check_matching_dims("elt_divide", "m1", m1, "m2", m2);

  return m1.array() / m2.array();
}

/**
 * Return the elementwise division of the specified matrix
 * by the specified scalar.
 *
 * @tparam T1 Type of scalars in the matrix.
 * @tparam T2 Type of the scalar.
 * @tparam R Row type of the matrix.
 * @tparam C Column type of the matrix.
 * @param m matrix
 * @param s scalar
 * @return Elementwise division of a scalar by matrix.
 */
template <typename T1, typename T2, int R, int C>
Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type, R, C>
  elt_divide(const Eigen::Matrix<T1, R, C>& m, T2 s) {
  return m.array() / s;
}

/**
 * Return the elementwise division of the specified scalar
 * by the specified matrix.
 *
 * @tparam T1 Type of the scalar.
 * @tparam T2 Type of scalars in the matrix.
 * @tparam R Row type of the matrix.
 * @tparam C Column type of the matrix.
 * @param s scalar
 * @param m matrix
 * @return Elementwise division of a scalar by matrix.
 */
template <typename T1, typename T2, int R, int C>
Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type, R, C>
  elt_divide(T1 s, const Eigen::Matrix<T2, R, C>& m) {
  return s / m.array();
}

}  // namespace math
}  // namespace stan
#endif<commit_msg>[Jenkins] auto-formatting by clang-format version 5.0.2-svn328729-1~exp1~20180509124008.99 (branches/release_50)<commit_after>#ifndef STAN_MATH_PRIM_MAT_FUN_ELT_DIVIDE_HPP
#define STAN_MATH_PRIM_MAT_FUN_ELT_DIVIDE_HPP

#include <boost/math/tools/promotion.hpp>
#include <stan/math/prim/mat/fun/Eigen.hpp>
#include <stan/math/prim/mat/err/check_matching_dims.hpp>

namespace stan {
namespace math {

/**
 * Return the elementwise division of the specified matrices.
 *
 * @tparam T1 Type of scalars in first matrix.
 * @tparam T2 Type of scalars in second matrix.
 * @tparam R Row type of both matrices.
 * @tparam C Column type of both matrices.
 * @param m1 First matrix
 * @param m2 Second matrix
 * @return Elementwise division of matrices.
 */
template <typename T1, typename T2, int R, int C>
Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type, R, C>
elt_divide(const Eigen::Matrix<T1, R, C>& m1,
           const Eigen::Matrix<T2, R, C>& m2) {
  check_matching_dims("elt_divide", "m1", m1, "m2", m2);

  return m1.array() / m2.array();
}

/**
 * Return the elementwise division of the specified matrix
 * by the specified scalar.
 *
 * @tparam T1 Type of scalars in the matrix.
 * @tparam T2 Type of the scalar.
 * @tparam R Row type of the matrix.
 * @tparam C Column type of the matrix.
 * @param m matrix
 * @param s scalar
 * @return Elementwise division of a scalar by matrix.
 */
template <typename T1, typename T2, int R, int C>
Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type, R, C>
elt_divide(const Eigen::Matrix<T1, R, C>& m, T2 s) {
  return m.array() / s;
}

/**
 * Return the elementwise division of the specified scalar
 * by the specified matrix.
 *
 * @tparam T1 Type of the scalar.
 * @tparam T2 Type of scalars in the matrix.
 * @tparam R Row type of the matrix.
 * @tparam C Column type of the matrix.
 * @param s scalar
 * @param m matrix
 * @return Elementwise division of a scalar by matrix.
 */
template <typename T1, typename T2, int R, int C>
Eigen::Matrix<typename boost::math::tools::promote_args<T1, T2>::type, R, C>
elt_divide(T1 s, const Eigen::Matrix<T2, R, C>& m) {
  return s / m.array();
}

}  // namespace math
}  // namespace stan
#endif
{'fraction_non_alphanumeric': 0.1238204833141542, 'fraction_numerical': 0.02232451093210587, 'mean_word_length': 4.083040935672515, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3614349', 'n_tokens_mistral': 1558, 'n_tokens_neox': 1518, 'n_words': 521}