Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ grad() [1/2]

template<typename T >
void stan::math::var_value< T, require_floating_point_t< T > >::grad ( std::vector< var_value< T > > &  x,
std::vector< value_type > &  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.

Template Parameters
CheckContainerNot set by user. The default value of value_type is used to require that grad is only available for scalar var_value types.
Parameters
xVector of independent variables.
gGradient vector of partial derivatives of this variable with respect to x.

Definition at line 132 of file var.hpp.