Automatic Differentiation
 
Loading...
Searching...
No Matches
is_matching_dims.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_ERR_IS_MATCHING_DIMS_HPP
2#define STAN_MATH_PRIM_ERR_IS_MATCHING_DIMS_HPP
3
7
8namespace stan {
9namespace math {
10
20template <typename EigMat1, typename EigMat2,
21 require_all_matrix_t<EigMat1, EigMat2>* = nullptr>
22inline bool is_matching_dims(const EigMat1& y1, const EigMat2& y2) {
23 return is_size_match(y1.rows(), y2.rows())
24 && is_size_match(y1.cols(), y2.cols());
25}
26
39template <bool check_compile, typename EigMat1, typename EigMat2,
41inline bool is_matching_dims(const EigMat1& y1, const EigMat2& y2) {
42 return !(check_compile
43 && (EigMat1::RowsAtCompileTime != EigMat2::RowsAtCompileTime
44 || EigMat1::ColsAtCompileTime != EigMat2::ColsAtCompileTime))
45 && is_matching_dims(y1, y2);
46}
47
48} // namespace math
49} // namespace stan
50#endif
require_all_t< is_matrix< std::decay_t< Types > >... > require_all_matrix_t
Require all of the types satisfy is_matrix.
Definition is_matrix.hpp:38
bool is_size_match(T_size1 i, T_size2 j)
Return true if the provided sizes match.
bool is_matching_dims(const EigMat1 &y1, const EigMat2 &y2)
Return true if the two matrices are of the same size.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Definition fvar.hpp:9