1 #ifndef STAN_MATH_FWD_CORE_FVAR_HPP 2 #define STAN_MATH_FWD_CORE_FVAR_HPP 69 fvar() : val_(0.0), d_(0.0) {}
87 fvar(
const T& v) : val_(v), d_(0.0) {
102 template <
typename V>
121 template <
typename V,
typename D>
122 fvar(
const V& v,
const D& d) : val_(v), d_(d) {
185 d_ = d_ * x2.
val_ + val_ * x2.
d_;
283 friend std::ostream& operator<<(std::ostream& os, const fvar<T>& v) {
T tangent() const
Return the tangent (derivative) of this variable.
T d_
The tangent (derivative) of this variable.
fvar< T > & operator-=(const fvar< T > &x2)
Subtract the specified variable from this variable and return a reference to this variable...
fvar< T > & operator/=(double x2)
Divide this value by the the specified variable and return a reference to this variable.
fvar(const V &v, const D &d)
Construct a forward variable with the specified value and tangent.
fvar< T > operator--(int)
Decrement this variable by one and return a reference to a copy of this variable before it was decrem...
fvar(const fvar< T > &x)
Construct a forward variable with value and tangent set to the value and tangent of the specified var...
fvar< T > & operator+=(const fvar< T > &x2)
Add the specified variable to this variable and return a reference to this variable.
fvar< T > & operator++()
Increment this variable by one and return a reference to this variable after the increment.
T val_
The value of this variable.
fvar(const V &v, typename std::enable_if< ad_promotable< V, T >::value >::type *dummy=0)
Construct a forward variable with the specified value and zero tangent.
fvar< T > & operator--()
Decrement this variable by one and return a reference to this variable after the decrement.
fvar< T > operator++(int)
Increment this variable by one and return a reference to a copy of this variable before it was increm...
fvar< T > & operator-=(double x2)
Subtract the specified value from this variable and return a reference to this variable.
T val() const
Return the value of this variable.
fvar< T > & operator+=(double x2)
Add the specified value to this variable and return a reference to this variable. ...
fvar(const T &v)
Construct a forward variable with the specified value and zero tangent.
fvar< T > & operator*=(const fvar< T > &x2)
Multiply this variable by the the specified variable and return a reference to this variable...
fvar()
Construct a forward variable with zero value and tangent.
int is_nan(const fvar< T > &x)
Returns 1 if the input's value is NaN and 0 otherwise.
fvar< T > & operator*=(double x2)
Multiply this variable by the the specified value and return a reference to this variable.
fvar< T > & operator/=(const fvar< T > &x2)
Divide this variable by the the specified variable and return a reference to this variable...
This template class represents scalars used in forward-mode automatic differentiation, which consist of values and directional derivatives of the specified template type.