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

◆ apply_scalar_ternary() [1/3]

template<typename F , typename T1 , typename T2 , typename T3 , require_all_stan_scalar_t< T1, T2, T3 > * = nullptr>
auto stan::math::apply_scalar_ternary ( const F &  f,
const T1 &  x,
const T2 &  y,
const T3 &  z 
)
inline

Base template function for vectorization of ternary scalar functions defined by applying a functor to a combination of scalars, containers of matching sizes, or a combination of a scalar and a container.

Specialization for use with three nested containers (std::vectors).

Specialization for use with (non-nested) std::vectors.

These containers can be a standard library vector, Eigen dense matrix expression template, or container of these. For each specialization, the same type as the largest (dimension) input is returned.

This base template function takes (and returns) scalars.

Template Parameters
T1An Arithmetic, Integral, var, or fvar<T> type.
T2An Arithmetic, Integral, var, or fvar<T> type.
T3An Arithmetic, Integral, var, or fvar<T> type.
FType of functor to apply.
Parameters
xFirst input to which operation is applied.
ySecond input to which operation is applied.
zThird scalar to which operation is applied.
ffunctor to apply to inputs.
Returns
Scalar with result of applying functor to inputs.

Inputs are mapped to Eigen column vectors and then the result is evaluated directly into the returned std::vector (via Eigen::Map).

The returned scalar type is deduced to allow for cases where the input and return scalar types differ (e.g., functions implicitly promoting integers).

Template Parameters
T1Type of first std::vector to which functor is applied.
T2Type of second std::vector to which functor is applied.
T3Type of third std::vector to which functor is applied.
FType of functor to apply.
Parameters
xFirst std::vector input to which operation is applied.
ySecond std::vector input to which operation is applied.
zThird std::vector input to which operation is applied.
ffunctor to apply to std::vector inputs.
Returns
std::vector with result of applying functor to inputs.

The returned scalar type is deduced to allow for cases where the input and return scalar types differ (e.g., functions implicitly promoting integers).

Template Parameters
T1Type of first std::vector to which functor is applied.
T2Type of second std::vector to which functor is applied.
T3Type of second std::vector to which functor is applied.
FType of functor to apply.
Parameters
xFirst std::vector input to which operation is applied.
ySecond std::vector input to which operation is applied.
zThird std::vector input to which operation is applied.
ffunctor to apply to std::vector inputs.
Returns
std::vector with result of applying functor to inputs.

Definition at line 39 of file apply_scalar_ternary.hpp.