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
Show file tree
Hide file tree
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
Next Next 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 22, 2021
commit 5da0a5dfe02ade8534753aebf22ce3e5d168fdea
6 changes: 3 additions & 3 deletions stan/math/prim/functor/apply_scalar_binary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@ inline auto apply_scalar_binary(const T1& x, const T2& y, const F& f) {
return result;
}


/**
* Specialisation for use with two nested containers (std::vectors).
* The returned scalar type is deduced to allow for cases where the input and
Expand All @@ -321,8 +320,9 @@ inline auto apply_scalar_binary(const T1& x, const T2& y, const F& f) {
* @param f functor to apply to std::vector inputs.
* @return std::vector with result of applying functor to inputs.
*/
template <typename T1, typename T2, typename F,
require_all_std_vector_vt<is_container_or_var_matrix, T1, T2>* = nullptr>
template <
typename T1, typename T2, typename F,
require_all_std_vector_vt<is_container_or_var_matrix, T1, T2>* = nullptr>
inline auto apply_scalar_binary(const T1& x, const T2& y, const F& f) {
check_matching_sizes("Binary function", "x", x, "y", y);
using T_return = plain_type_t<decltype(apply_scalar_binary(x[0], y[0], f))>;
Expand Down
11 changes: 7 additions & 4 deletions stan/math/prim/meta/is_container_or_var_matrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ namespace stan {
* @tparam Container type to check
*/
template <typename Container>
using is_container_or_var_matrix = bool_constant<
math::disjunction<is_container<Container>, is_var_matrix<Container>>::value>;
using is_container_or_var_matrix
= bool_constant<math::disjunction<is_container<Container>,
is_var_matrix<Container>>::value>;

STAN_ADD_REQUIRE_UNARY(container_or_var_matrix, is_container_or_var_matrix, general_types);
STAN_ADD_REQUIRE_CONTAINER(container_or_var_matrix, is_container_or_var_matrix, general_types);
STAN_ADD_REQUIRE_UNARY(container_or_var_matrix, is_container_or_var_matrix,
general_types);
STAN_ADD_REQUIRE_CONTAINER(container_or_var_matrix, is_container_or_var_matrix,
general_types);

} // namespace stan

Expand Down
4 changes: 0 additions & 4 deletions stan/math/rev/functor/apply_scalar_binary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
namespace stan {
namespace math {



/**
* Specialisation for use with one `var_value<Eigen vector>` (row or column) and
* a one-dimensional std::vector of integer types
Expand Down Expand Up @@ -135,8 +133,6 @@ inline auto apply_scalar_binary(const T1& x, const T2& y, const F& f) {
return f(x, y);
}



} // namespace math
} // namespace stan
#endif