|
bool | is_uninitialized () |
| Return true if this variable has been declared, but not been defined. More...
|
|
| var () |
| Construct a variable for later assignment. More...
|
|
| var (vari *vi) |
| Construct a variable from a pointer to a variable implementation. More...
|
|
| var (float x) |
| Construct a variable from the specified arithmetic argument by constructing a new vari with the argument cast to double , and a zero adjoint. More...
|
|
| var (double x) |
| Construct a variable from the specified arithmetic argument by constructing a new vari with the argument as a value and a zero adjoint. More...
|
|
| var (long double x) |
| Construct a variable from the specified arithmetic argument by constructing a new vari with the argument cast to double , and a zero adjoint. More...
|
|
| var (bool x) |
| Construct a variable from the specified arithmetic argument by constructing a new vari with the argument cast to double , and a zero adjoint. More...
|
|
| var (char x) |
| Construct a variable from the specified arithmetic argument by constructing a new vari with the argument cast to double , and a zero adjoint. More...
|
|
| var (short x) |
| Construct a variable from the specified arithmetic argument by constructing a new vari with the argument cast to double , and a zero adjoint. More...
|
|
| var (int x) |
| Construct a variable from the specified arithmetic argument by constructing a new vari with the argument cast to double , and a zero adjoint. More...
|
|
| var (long x) |
| Construct a variable from the specified arithmetic argument by constructing a new vari with the argument cast to double , and a zero adjoint. More...
|
|
| var (unsigned char x) |
| Construct a variable from the specified arithmetic argument by constructing a new vari with the argument cast to double , and a zero adjoint. More...
|
|
| var (unsigned short x) |
| Construct a variable from the specified arithmetic argument by constructing a new vari with the argument cast to double , and a zero adjoint. More...
|
|
| var (unsigned int x) |
| Construct a variable from the specified arithmetic argument by constructing a new vari with the argument cast to double , and a zero adjoint. More...
|
|
| var (unsigned long x) |
| Construct a variable from the specified arithmetic argument by constructing a new vari with the argument cast to double , and a zero adjoint. 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...
|
|
void | grad () |
| Compute the gradient of this (dependent) variable with respect to all (independent) variables. 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+= (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-= (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*= (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/= (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 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 var values objects.
Definition at line 30 of file var.hpp.
void stan::math::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 258 of file var.hpp.
vari& stan::math::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 290 of file var.hpp.
vari* stan::math::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 304 of file var.hpp.