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

◆ make_callback_vari()

template<typename T , typename F >
internal::callback_vari< plain_type_t< T >, F > * stan::math::make_callback_vari ( T &&  value,
F &&  functor 
)

Creates a new vari with given value and a callback that implements the reverse pass (chain).

The callback needs to accept a referenct to the vari. If it needs any other data it should be implemented as a lambda capturing the variables it needs.

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 41 of file callback_vari.hpp.