Stan Math Library  2.20.0
reverse mode automatic differentiation
is_not_nan.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_ERR_IS_NOT_NAN_HPP
2 #define STAN_MATH_PRIM_SCAL_ERR_IS_NOT_NAN_HPP
3 
7 
8 namespace stan {
9 namespace math {
10 
20 template <typename T_y>
21 inline bool is_not_nan(const T_y& y) {
22  for (size_t n = 0; n < stan::length(y); ++n) {
23  if (is_nan(value_of_rec(stan::get(y, n))))
24  return false;
25  }
26  return true;
27 }
28 
29 } // namespace math
30 } // namespace stan
31 #endif
double value_of_rec(const fvar< T > &v)
Return the value of the specified variable.
size_t length(const std::vector< T > &x)
Returns the length of the provided std::vector.
Definition: length.hpp:16
T get(const std::vector< T > &x, size_t n)
Returns the n-th element of the provided std::vector.
Definition: get.hpp:16
bool is_not_nan(const T_y &y)
Return true if y is not NaN.
Definition: is_not_nan.hpp:21
int is_nan(const fvar< T > &x)
Returns 1 if the input&#39;s value is NaN and 0 otherwise.
Definition: is_nan.hpp:20

     [ Stan Home Page ] © 2011–2018, Stan Development Team.