Stan Math Library  2.20.0
reverse mode automatic differentiation
is_matching_dims.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_MAT_ERR_IS_MATCHING_DIMS_HPP
2 #define STAN_MATH_PRIM_MAT_ERR_IS_MATCHING_DIMS_HPP
3 
7 
8 namespace stan {
9 namespace math {
10 
26 template <typename T1, typename T2, int R1, int C1, int R2, int C2>
27 inline bool is_matching_dims(const Eigen::Matrix<T1, R1, C1>& y1,
28  const Eigen::Matrix<T2, R2, C2>& y2) {
29  return is_size_match(y1.rows(), y2.rows())
30  && is_size_match(y1.cols(), y2.cols());
31 }
32 
49 template <bool check_compile, typename T1, typename T2, int R1, int C1, int R2,
50  int C2>
51 inline bool is_matching_dims(const Eigen::Matrix<T1, R1, C1>& y1,
52  const Eigen::Matrix<T2, R2, C2>& y2) {
53  return !(check_compile && (R1 != R2 || C1 != C2)) && is_matching_dims(y1, y2);
54 }
55 
56 } // namespace math
57 } // namespace stan
58 #endif
bool is_matching_dims(const Eigen::Matrix< T1, R1, C1 > &y1, const Eigen::Matrix< T2, R2, C2 > &y2)
Return true if the two matrices are of the same size.
bool is_size_match(T_size1 i, T_size2 j)
Return true if the provided sizes match.

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