Stan Math Library: stan/math/rev/core/operator_unary_plus.hpp Source File

| Stan Math Library 2.10.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

operator_unary_plus.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_REV_CORE_OPERATOR_UNARY_PLUS_HPP
2 #define STAN_MATH_REV_CORE_OPERATOR_UNARY_PLUS_HPP
3
4 #include <stan/math/rev/core/var.hpp>
5 #include <boost/math/special_functions/fpclassify.hpp>
6 #include <stan/math/rev/core/precomp_v_vari.hpp>
7 #include <stan/math/prim/scal/fun/constants.hpp>
8
9 namespace stan {
10 namespace math {
11
43 inline var operator+(const var& a) {
44 if (unlikely(boost::math::isnan(a.vi_->val_)))
45 return var(new precomp_v_vari(stan::math::NOT_A_NUMBER,
46 a.vi_,
47 stan::math::NOT_A_NUMBER));
48 return a;
49 }
50
51 }
52 }
53 #endif
precomp_v_vari.hpp
stan::math::NOT_A_NUMBER
const double NOT_A_NUMBER
(Quiet) not-a-number value.
Definition: constants.hpp:56
stan
Definition: log_sum_exp.hpp:8
stan::math::var
Independent (input) and dependent (output) variables for gradients.
Definition: var.hpp:31
stan::math::vari::val_
const double val_
The value of this variable.
Definition: vari.hpp:38
boost::math::isnan
bool isnan(const stan::math::var &v)
Checks if the given number is NaN.
Definition: boost_isnan.hpp:22
unlikely
#define unlikely(x)
Definition: likely.hpp:9
stan::math::var::vi_
vari * vi_
Pointer to the implementation of this variable.
Definition: var.hpp:43
var.hpp
stan::math::operator+
fvar< T > operator+(const fvar< T > &x1, const fvar< T > &x2)
Definition: operator_addition.hpp:13
constants.hpp
stan::math::precomp_v_vari
Definition: precomp_v_vari.hpp:11

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