1 #ifndef STAN_MATH_PRIM_FUN_MAX_SIZE_MVT_HPP
2 #define STAN_MATH_PRIM_FUN_MAX_SIZE_MVT_HPP
3 
4 #include <stan/math/prim/fun/size_mvt.hpp>
5 #include <algorithm>
6 
7 namespace stan {
8 namespace math {
9 
10 /**
11  * Calculate the size of the largest multivariate input. A multivariate
12  * container is either an Eigen matrix, whose mvt size is 1, or an std::vector
13  * of Eigen matrices, whose mvt size is the size of the std::vector. It is an
14  * error to supply any other type of input.
15  * @tparam T1 type of the first input
16  * @tparam Ts types of the other inputs
17  * @param x1 first input
18  * @param xs other inputs
19  * @return the size of the largest input
20  * @throw `invalid_argument` if provided with an input that is not an Eigen
21  * matrix or std::vector of Eigen matrices
22  */
23 template <typename T1, typename... Ts>
max_size_mvt(const T1 & x1,const Ts &...xs)24 inline size_t max_size_mvt(const T1& x1, const Ts&... xs) {
25   return std::max({stan::math::size_mvt(x1), stan::math::size_mvt(xs)...});
26 }
27 
28 }  // namespace math
29 }  // namespace stan
30 #endif
31