1 #ifndef __STAN__MATH__MATRIX__SUBTRACT_HPP__
2 #define __STAN__MATH__MATRIX__SUBTRACT_HPP__
4 #include <boost/math/tools/promotion.hpp>
24 template <
typename T1,
typename T2,
int R,
int C>
26 Eigen::Matrix<typename boost::math::tools::promote_args<T1,T2>::type, R, C>
28 const Eigen::Matrix<T2,R,C>& m2) {
30 Eigen::Matrix<typename boost::math::tools::promote_args<T1,T2>::type, R, C>
31 result(m1.rows(), m1.cols());
32 for (
int i = 0; i < result.size(); ++i)
33 result(i) = m1(i) - m2(i);
37 template <
typename T1,
typename T2,
int R,
int C>
39 Eigen::Matrix<typename boost::math::tools::promote_args<T1,T2>::type, R, C>
41 const Eigen::Matrix<T2,R,C>& m) {
42 Eigen::Matrix<typename boost::math::tools::promote_args<T1,T2>::type, R, C>
43 result(m.rows(),m.cols());
44 for (
int i = 0; i < m.size(); ++i)
49 template <
typename T1,
typename T2,
int R,
int C>
51 Eigen::Matrix<typename boost::math::tools::promote_args<T1,T2>::type, R, C>
54 Eigen::Matrix<typename boost::math::tools::promote_args<T1,T2>::type, R, C>
55 result(m.rows(),m.cols());
56 for (
int i = 0; i < m.size(); ++i)