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

◆ apply_scalar_binary() [2/3]

template<typename F , typename T1 , typename T2 , require_eigen_vector_vt< is_stan_scalar, T1 > * = nullptr, require_std_vector_vt< std::is_integral, T2 > * = nullptr>
auto stan::math::apply_scalar_binary ( F &&  f,
T1 &&  x,
T2 &&  y 
)
inline

Specialization for use with one Eigen vector (row or column) and a one-dimensional std::vector of integer types.

Specialization for use when the one input is an `var_value<Eigen> type and the other is a scalar.

Specialization for use with one var_value<Eigen vector> (row or column) and a one-dimensional std::vector of integer types.

Specialization for use with combinations of Eigen::Matrix and var_value<Eigen::Matrix> inputs.

Specialization for use when the first input is a scalar and the second is a nested std::vector.

Specialization for use when the first input is a nested std::vector and the second is a scalar.

Specialization for use when the first input is a scalar and the second is a (non-nested) std::vector.

Specialization for use when the first input is a (non-nested) std::vector and the second is a scalar.

Specialization for use when the first input is an scalar and the second is an Eigen type.

Specialization for use when the first input is an Eigen type and the second is a scalar.

Specialization for use with a one-dimensional std::vector of integer types and one Eigen vector (row or column).

Template Parameters
FType of functor to apply.
T1Type of first argument to which functor is applied.
T2Type of second argument to which functor is applied.
Parameters
ffunctor to apply to inputs.
xEigen input to which operation is applied.
yInteger std::vector input to which operation is applied.
Returns
Eigen object with result of applying functor to inputs.
Template Parameters
FType of functor to apply.
T1Type of first argument to which functor is applied.
T2Type of second argument to which functor is applied.
Parameters
ffunctor to apply to inputs.
xInteger std::vector input to which operation is applied.
yEigen input to which operation is applied.
Returns
Eigen object with result of applying functor to inputs.

Eigen's unaryExpr framework is used for more efficient indexing of both row- and column-major inputs. The unaryExpr framework also allows for the scalar to be captured and applied to each element in the Eigen object.

Template Parameters
FType of functor to apply.
T1Type of Eigen object to which functor is applied.
T2Type of scalar to which functor is applied.
Parameters
ffunctor to apply to Eigen and scalar inputs.
xEigen input to which operation is applied.
yScalar input to which operation is applied.
Returns
Eigen object with result of applying functor to inputs.

Eigen's unaryExpr framework is used for more efficient indexing of both row- and column-major inputs. The unaryExpr framework also allows for the scalar to be captured and applied to each element in the Eigen object.

Template Parameters
FType of functor to apply.
T1Type of scalar to which functor is applied.
T2Type of Eigen object to which functor is applied.
Parameters
ffunctor to apply to Eigen and scalar inputs.
xScalar input to which operation is applied.
yEigen input to which operation is applied.
Returns
Eigen object with result of applying functor to inputs.

The std::vector input is mapped to an Eigen column vector 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
FType of functor to apply.
T1Type of std::vector to which functor is applied.
T2Type of scalar to which functor is applied.
Parameters
ffunctor to apply to std::vector and scalar inputs.
xstd::vector input to which operation is applied.
yScalar input to which operation is applied.
Returns
std::vector with result of applying functor to inputs.

The std::vector input is mapped to an Eigen column vector 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
FType of functor to apply.
T1Type of scalar to which functor is applied.
T2Type of std::vector to which functor is applied.
Parameters
ffunctor to apply to std::vector and scalar inputs.
xScalar input to which operation is applied.
ystd::vector input to which operation is applied.
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
FType of functor to apply.
T1Type of std::vector to which functor is applied.
T2Type of scalar to which functor is applied.
Parameters
ffunctor to apply to inputs.
xstd::vector input to which operation is applied.
yScalar input to which operation is applied.
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
FType of functor to apply.
T1Type of scalar to which functor is applied.
T2Type of std::vector to which functor is applied.
Parameters
ffunctor to apply to inputs.
xScalar input to which operation is applied.
ystd::vector input to which operation is applied.
Returns
std::vector with result of applying functor to inputs.

Eigen's binaryExpr framework is used for more efficient indexing of both row- and column-major inputs without separate loops.

Template Parameters
FType of functor to apply.
T1Type of first argument to which functor is applied.
T2Type of second argument to which functor is applied.
Parameters
ffunctor to apply to Matrix inputs.
xFirst Matrix input to which operation is applied.
ySecond Matrix input to which operation is applied.
Returns
var_value<Matrix> with result of applying functor to inputs.
Template Parameters
FType of functor to apply.
T1Type of first argument to which functor is applied.
T2Type of second argument to which functor is applied.
Parameters
ffunctor to apply to inputs.
xMatrix input to which operation is applied.
yInteger std::vector input to which operation is applied.
Returns
var_value<Eigen> object with result of applying functor to inputs.
Template Parameters
FType of functor to apply.
T1Type of either var_value<Matrix> or scalar object to which functor is applied.
T2Type of either var_value<Matrix> or scalar object to which functor is applied.
Parameters
ffunctor to apply to var matrix and scalar inputs.
xMatrix or Scalar input to which operation is applied.
xMatrix or Scalar input to which operation is applied.
Returns
`var_value<Matrix> object with result of applying functor to inputs.

Definition at line 82 of file apply_scalar_binary.hpp.