1 #ifndef STAN_MATH_PRIM_FUN_MAX_SIZE_HPP
2 #define STAN_MATH_PRIM_FUN_MAX_SIZE_HPP
3 
4 #include <stan/math/prim/fun/size.hpp>
5 #include <algorithm>
6 
7 namespace stan {
8 namespace math {
9 
10 /**
11  * Calculate the size of the largest input.
12  * @tparam T1 type of the first input
13  * @tparam Ts types of the other inputs
14  * @param x1 first input
15  * @param xs other inputs
16  * @return the size of the largest input
17  */
18 template <typename T1, typename... Ts>
max_size(const T1 & x1,const Ts &...xs)19 inline size_t max_size(const T1& x1, const Ts&... xs) {
20   return std::max({stan::math::size(x1), stan::math::size(xs)...});
21 }
22 
23 }  // namespace math
24 }  // namespace stan
25 #endif
26