Automatic Differentiation
 
Loading...
Searching...
No Matches
is_scal_finite.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_ERR_IS_SCAL_FINITE_HPP
2#define STAN_MATH_PRIM_ERR_IS_SCAL_FINITE_HPP
3
8#include <cmath>
9
10namespace stan {
11namespace math {
12
21template <typename T_y>
22inline bool is_scal_finite(const T_y& y) {
23 for (size_t n = 0; n < stan::math::size(y); ++n) {
24 if (!std::isfinite(value_of_rec(stan::get(y, n)))) {
25 return false;
26 }
27 }
28 return true;
29}
30
31} // namespace math
32} // namespace stan
33#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
double value_of_rec(const fvar< T > &v)
Return the value of the specified variable.
bool is_scal_finite(const T_y &y)
Return true if y is finite.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...