|
| bool | is_uninitialized () |
| | Return true if this variable has been declared, but not been defined. More...
|
| |
| | var (vari *vi) |
| | Construct a variable from a pointer to a variable implementation. More...
|
| |
| | var () |
| | Construct a variable for later assignment. More...
|
| |
| | var (bool b) |
| | Construct a variable by static casting the specified value to double. More...
|
| |
| | var (char c) |
| | Construct a variable by static casting the specified value to double. More...
|
| |
| | var (short n) |
| | Construct a variable by static casting the specified value to double. More...
|
| |
| | var (unsigned short n) |
| | Construct a variable by static casting the specified value to double. More...
|
| |
| | var (int n) |
| | Construct a variable by static casting the specified value to double. More...
|
| |
| | var (unsigned int n) |
| | Construct a variable by static casting the specified value to double. More...
|
| |
| | var (long int n) |
| | Construct a variable by static casting the specified value to double. More...
|
| |
| | var (unsigned long int n) |
| | Construct a variable by static casting the specified value to double. More...
|
| |
| | var (unsigned long long n) |
| | Construct a variable by static casting the specified value to double. More...
|
| |
| | var (long long n) |
| | Construct a variable by static casting the specified value to double. More...
|
| |
| | var (float x) |
| | Construct a variable by static casting the specified value to double. More...
|
| |
| | var (double x) |
| | Construct a variable with the specified value. More...
|
| |
| | var (long double x) |
| | Construct a variable by static casting the specified value to double. More...
|
| |
| double | val () const |
| | Return the value of this variable. More...
|
| |
| double | adj () const |
| | Return the derivative of the root expression with respect to this expression. More...
|
| |
| void | grad (std::vector< var > &x, std::vector< double > &g) |
| | Compute the gradient of this (dependent) variable with respect to the specified vector of (independent) variables, assigning the specified vector to the gradient. More...
|
| |
| vari & | operator* () |
| | Return a reference to underlying implementation of this variable. More...
|
| |
| vari * | operator-> () |
| | Return a pointer to the underlying implementation of this variable. More...
|
| |
| var & | operator+= (const var &b) |
| | The compound add/assignment operator for variables (C++). More...
|
| |
| var & | operator+= (const double b) |
| | The compound add/assignment operator for scalars (C++). More...
|
| |
| var & | operator-= (const var &b) |
| | The compound subtract/assignment operator for variables (C++). More...
|
| |
| var & | operator-= (const double b) |
| | The compound subtract/assignment operator for scalars (C++). More...
|
| |
| var & | operator*= (const var &b) |
| | The compound multiply/assignment operator for variables (C++). More...
|
| |
| var & | operator*= (const double b) |
| | The compound multiply/assignment operator for scalars (C++). More...
|
| |
| var & | operator/= (const var &b) |
| | The compound divide/assignment operator for variables (C++). More...
|
| |
| var & | operator/= (const double b) |
| | The compound divide/assignment operator for scalars (C++). More...
|
| |
Independent (input) and dependent (output) variables for gradients.
This class acts as a smart pointer, with resources managed by an agenda-based memory manager scoped to a single gradient calculation.
An agrad::var is constructed with a double and used like any other scalar. Arithmetical functions like negation, addition, and subtraction, as well as a range of mathematical functions like exponentiation and powers are overridden to operate on agrad::var values objects.
Definition at line 27 of file var.hpp.
| void stan::agrad::var::grad |
( |
std::vector< var > & |
x, |
|
|
std::vector< double > & |
g |
|
) |
| |
|
inline |
Compute the gradient of this (dependent) variable with respect to the specified vector of (independent) variables, assigning the specified vector to the gradient.
The grad() function does not recover memory. In Stan 2.4 and earlier, this function did recover memory.
- Parameters
-
| x | Vector of independent variables. |
| g | Gradient vector of partial derivatives of this variable with respect to x. |
Definition at line 237 of file var.hpp.
| vari& stan::agrad::var::operator* |
( |
| ) |
|
|
inline |
Return a reference to underlying implementation of this variable.
If x is of type var, then applying this operator, *x, has the same behavior as *(x.vi_).
Warning: The returned reference does not track changes to this variable.
- Returns
- variable
Definition at line 259 of file var.hpp.
| vari* stan::agrad::var::operator-> |
( |
| ) |
|
|
inline |
Return a pointer to the underlying implementation of this variable.
If x is of type var, then applying this operator, x->, behaves the same way as x.vi_->.
Warning: The returned result does not track changes to this variable.
Definition at line 273 of file var.hpp.