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.
- Template Parameters
-
CheckContainer | Not set by user. The default value of value_type is used to require that grad is only available for scalar var_value types. |
- Parameters
-
x | Vector of independent variables. |
g | Gradient vector of partial derivatives of this variable with respect to x. |
Definition at line 132 of file var.hpp.