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

◆ vari_value() [2/3]

template<typename T >
template<typename S , require_assignable_t< T, S > * = nullptr>
stan::math::vari_value< T, require_all_t< is_plain_type< T >, is_eigen_dense_base< T > > >::vari_value ( const S &  x,
bool  stacked 
)
inline

Construct a dense Eigen variable implementation from a value.

The adjoint is initialized to zero and if stacked is false this vari will be not be put on the var_stack. Instead it will only be put on a stack to keep track of whether the adjoint needs to be set to zero. Variables should be constructed before variables on which they depend to insure proper partial derivative propagation. During derivative propagation, the chain() method of each variable will be called in the reverse order of construction.

Template Parameters
SA dense Eigen type that is convertible to value_type
Parameters
xValue of the constructed variable.
stackedIf false will put this this vari on the nochain stack so that its chain() method is not called.

Definition at line 721 of file vari.hpp.