Automatic Differentiation
 
Loading...
Searching...
No Matches
is_positive.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_ERR_IS_POSITIVE_HPP
2#define STAN_MATH_PRIM_ERR_IS_POSITIVE_HPP
3
7
8namespace stan {
9namespace math {
10
19template <typename T_y>
20inline bool is_positive(const T_y& y) {
21 for (size_t n = 0; n < stan::math::size(y); ++n) {
22 if (!(stan::get(y, n) > 0)) {
23 return false;
24 }
25 }
26 return true;
27}
28
34inline bool is_positive(int size) { return size > 0; }
35
36} // namespace math
37} // namespace stan
38#endif
T get(const T &x, size_t n)
Returns the provided element.
Definition get.hpp:23
int64_t size(const T &m)
Returns the size (number of the elements) of a matrix_cl or var_value<matrix_cl<T>>.
Definition size.hpp:19
bool is_positive(const T_y &y)
Return true if y is positive.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...