operator_unary_plus.hpp
Go to the documentation of this file.
#ifndef STAN_MATH_REV_CORE_OPERATOR_UNARY_PLUS_HPP
#define STAN_MATH_REV_CORE_OPERATOR_UNARY_PLUS_HPP
#include <stan/math/rev/core/var.hpp>
#include <stan/math/prim/scal/fun/is_nan.hpp>
#include <stan/math/rev/core/precomp_v_vari.hpp>
#include <stan/math/prim/scal/fun/constants.hpp>
namespace stan {
namespace math {
inline var operator+(const var& a) {
if (unlikely(is_nan(a.vi_->val_)))
return var(new precomp_v_vari(NOT_A_NUMBER,
a.vi_,
NOT_A_NUMBER));
return a;
}
}
}
#endif
precomp_v_vari.hpp
stan::math::NOT_A_NUMBER
const double NOT_A_NUMBER
(Quiet) not-a-number value.
Definition: constants.hpp:55
is_nan.hpp
stan
Definition: log_sum_exp.hpp:8
stan::math::var
Independent (input) and dependent (output) variables for gradients.
Definition: var.hpp:30
stan::math::vari::val_
const double val_
The value of this variable.
Definition: vari.hpp:38
unlikely
#define unlikely(x)
Definition: likely.hpp:9
stan::math::var::vi_
vari * vi_
Pointer to the implementation of this variable.
Definition: var.hpp:42
var.hpp
stan::math::operator+
fvar< T > operator+(const fvar< T > &x1, const fvar< T > &x2)
Definition: operator_addition.hpp:12
constants.hpp
stan::math::precomp_v_vari
Definition: precomp_v_vari.hpp:11
stan::math::is_nan
int is_nan(const fvar< T > &x)
Returns 1 if the input&#39;s value is NaN and 0 otherwise.
Definition: is_nan.hpp:21

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