Stan Math Library
2.20.0
reverse mode automatic differentiation
stan
math
prim
scal
meta
max_size.hpp
Go to the documentation of this file.
1
#ifndef STAN_MATH_PRIM_SCAL_META_MAX_SIZE_HPP
2
#define STAN_MATH_PRIM_SCAL_META_MAX_SIZE_HPP
3
4
#include <
stan/math/prim/scal/meta/length.hpp
>
5
6
namespace
stan
{
7
8
template
<
typename
T1,
typename
T2>
9
size_t
max_size
(
const
T1& x1,
const
T2& x2) {
10
size_t
result =
length
(x1);
11
result = result >
length
(x2) ? result :
length
(x2);
12
return
result;
13
}
14
15
template
<
typename
T1,
typename
T2,
typename
T3>
16
size_t
max_size
(
const
T1& x1,
const
T2& x2,
const
T3& x3) {
17
size_t
result =
length
(x1);
18
result = result >
length
(x2) ? result :
length
(x2);
19
result = result >
length
(x3) ? result :
length
(x3);
20
return
result;
21
}
22
23
template
<
typename
T1,
typename
T2,
typename
T3,
typename
T4>
24
size_t
max_size
(
const
T1& x1,
const
T2& x2,
const
T3& x3,
const
T4& x4) {
25
size_t
result =
length
(x1);
26
result = result >
length
(x2) ? result :
length
(x2);
27
result = result >
length
(x3) ? result :
length
(x3);
28
result = result >
length
(x4) ? result :
length
(x4);
29
return
result;
30
}
31
32
template
<
typename
T1,
typename
T2,
typename
T3,
typename
T4,
typename
T5>
33
size_t
max_size
(
const
T1& x1,
const
T2& x2,
const
T3& x3,
const
T4& x4,
34
const
T5& x5) {
35
size_t
result =
length
(x1);
36
result = result >
length
(x2) ? result :
length
(x2);
37
result = result >
length
(x3) ? result :
length
(x3);
38
result = result >
length
(x4) ? result :
length
(x4);
39
result = result >
length
(x5) ? result :
length
(x5);
40
return
result;
41
}
42
43
}
// namespace stan
44
#endif
stan
Definition:
log_sum_exp.hpp:8
stan::length
size_t length(const std::vector< T > &x)
Returns the length of the provided std::vector.
Definition:
length.hpp:16
stan::max_size
size_t max_size(const T1 &x1, const T2 &x2)
Definition:
max_size.hpp:9
length.hpp
[
Stan Home Page
]
© 2011–2018, Stan Development Team.