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

◆ finite_diff()

template<typename F , typename... TArgs, require_any_st_fvar< TArgs... > * = nullptr>
auto stan::math::finite_diff ( const F &  func,
const TArgs &...  args 
)
inline

Construct an fvar<T> where the tangent is calculated by finite-differencing.

Finite-differencing is only perfomed where the scalar type to be evaluated is `fvar<T>.

Higher-order inputs (i.e., fvar & fvar<fvar<T>>) are also implicitly supported through auto-diffing the finite-differencing process.

Template Parameters
FType of functor for which fvar<T> support is needed
TArgsTemplate parameter pack of the types passed in the operator() of the functor type F. Must contain at least on type whose scalar type is fvar<T>
Parameters
funcFunctor for which fvar<T> support is needed
argsParameter pack of arguments to be passed to functor.

Finite-differencing is only perfomed where the scalar type to be evaluated is `fvar<T>.

This overload is used when no fvar<T> arguments are passed and simply evaluates the functor with the provided arguments.

Template Parameters
FType of functor
TArgsTemplate parameter pack of the types passed in the operator() of the functor type F. Must contain no type whose scalar type is fvar<T>
Parameters
funcFunctor
args...Parameter pack of arguments to be passed to functor.

Definition at line 69 of file finite_diff.hpp.