Stan Math Library  2.14.0
reverse mode automatic differentiation
check_matching_dims.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_MAT_ERR_CHECK_MATCHING_DIMS_HPP
2 #define STAN_MATH_PRIM_MAT_ERR_CHECK_MATCHING_DIMS_HPP
3 
7 #include <sstream>
8 
9 namespace stan {
10  namespace math {
11 
35  template <typename T1, typename T2, int R1, int C1, int R2, int C2>
36  inline void check_matching_dims(const char* function,
37  const char* name1,
38  const Eigen::Matrix<T1, R1, C1>& y1,
39  const char* name2,
40  const Eigen::Matrix<T2, R2, C2>& y2) {
41  check_size_match(function,
42  "Rows of ", name1, y1.rows(),
43  "rows of ", name2, y2.rows());
44  check_size_match(function,
45  "Columns of ", name1, y1.cols(),
46  "columns of ", name2, y2.cols());
47  }
48 
49  }
50 }
51 #endif
void check_matching_dims(const char *function, const char *name1, const Eigen::Matrix< T1, R1, C1 > &y1, const char *name2, const Eigen::Matrix< T2, R2, C2 > &y2)
Check if the two matrices are of the same size.
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.

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