Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds testing suite for nested binary var matrix functions #2502

Merged
merged 15 commits into from
Jun 30, 2021
Merged
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.0…
…4.1 (tags/RELEASE_600/final)
  • Loading branch information
stan-buildbot committed Jun 29, 2021
commit e23c84edc78b51cf70e15533c19ab80083720f11
15 changes: 9 additions & 6 deletions stan/math/rev/functor/apply_scalar_binary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ inline auto apply_scalar_binary(const T1& x, const T2& y, const F& f) {
* @tparam T1 Type of first argument to which functor is applied.
* @tparam T2 Type of second argument to which functor is applied.
* @tparam F Type of functor to apply.
* @param x Either a var matrix or nested integer std::vector input to which operation is applied.
* @param x Either a var matrix or nested integer std::vector input to which operation is applied.
* @param x Either a var matrix or nested integer std::vector input to which
* operation is applied.
* @param x Either a var matrix or nested integer std::vector input to which
* operation is applied.
* @param f functor to apply to inputs.
* @return Eigen object with result of applying functor to inputs.
*/
Expand All @@ -73,21 +75,22 @@ inline auto apply_scalar_binary(const T1& x, const T2& y, const F& f) {
return f(x, y);
}


/**
* Specialisation for use when the one input is an `var_value<Eigen> type and
* the other is a scalar.
*
* @tparam T1 Type of either `var_value<Matrix>` or scalar object to which functor is applied.
* @tparam T2 Type of either `var_value<Matrix>` or scalar object to which functor is applied.
* @tparam T1 Type of either `var_value<Matrix>` or scalar object to which
* functor is applied.
* @tparam T2 Type of either `var_value<Matrix>` or scalar object to which
* functor is applied.
* @tparam F Type of functor to apply.
* @param x Matrix or Scalar input to which operation is applied.
* @param x Matrix or Scalar input to which operation is applied.
* @param f functor to apply to var matrix and scalar inputs.
* @return `var_value<Matrix> object with result of applying functor to inputs.
*
*/
template <typename T1, typename T2, typename F,
template <typename T1, typename T2, typename F,
require_any_stan_scalar_t<T1, T2>* = nullptr,
require_any_var_matrix_t<T1, T2>* = nullptr>
inline auto apply_scalar_binary(const T1& x, const T2& y, const F& f) {
Expand Down