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

◆ make_callback_var()

template<typename T , typename F >
var_value< plain_type_t< T > > stan::math::make_callback_var ( T &&  value,
F &&  functor 
)

Creates a new var initialized with a callback_vari with a given value and reverse-pass callback functor.

The callback functor will be passed a reference to the constructed vari.

All captured values must be trivially destructible or they will leak memory. to_arena() function can be used to ensure that.

Template Parameters
Ttype of value
Ftype of callable
Parameters
valuevalue of the vari
functorfunctor or other callable to call in the reverse pass

Definition at line 61 of file callback_vari.hpp.