Stan  1.3
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Pages
elt_divide.hpp
Go to the documentation of this file.
1 #ifndef __STAN__MATH__MATRIX__ELT_DIVIDE_HPP__
2 #define __STAN__MATH__MATRIX__ELT_DIVIDE_HPP__
3 
4 #include <boost/math/tools/promotion.hpp>
7 
8 namespace stan {
9  namespace math {
10 
23  template <typename T1, typename T2, int R, int C>
24  Eigen::Matrix<typename boost::math::tools::promote_args<T1,T2>::type, R, C>
25  elt_divide(const Eigen::Matrix<T1,R,C>& m1,
26  const Eigen::Matrix<T2,R,C>& m2) {
27  stan::math::validate_matching_dims(m1,m2,"elt_multiply");
28  Eigen::Matrix<typename boost::math::tools::promote_args<T1,T2>::type, R, C>
29  result(m1.rows(),m2.cols());
30  for (int i = 0; i < m1.size(); ++i)
31  result(i) = m1(i) / m2(i);
32  return result;
33  }
34 
35  }
36 }
37 #endif

     [ Stan Home Page ] © 2011–2013, Stan Development Team.