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

◆ apply_scalar_binary() [1/5]

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

Base template function for vectorization of binary 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 two 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
T1Type of first argument to which functor is applied.
T2Type of second argument to which functor is applied.
FType of functor to apply.
Parameters
xFirst input to which operation is applied.
ySecond input to which operation is applied.
ffunctor to apply to inputs.
Returns
Scalar with result of applying functor to input.

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.
FType of functor to apply.
Parameters
xFirst std::vector input to which operation is applied.
ySecond 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.
FType of functor to apply.
Parameters
xFirst std::vector input to which operation is applied.
ySecond 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 37 of file apply_scalar_binary.hpp.