5#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_LINALG_ELEMENTWISE_BINARY_TRANSFORM_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_LINALG_ELEMENTWISE_BINARY_TRANSFORM_HPP_
11#include "arene/base/detail/index_permutation_range.hpp"
12#include "arene/base/linalg/detail/mandates.hpp"
13#include "arene/base/mdspan/detail/to_array.hpp"
14#include "arene/base/stdlib_choice/enable_if.hpp"
15#include "arene/base/stdlib_choice/is_assignable.hpp"
22namespace elementwise_binary_transform_detail {
24class elementwise_binary_transform_fn {
48 linalg_detail::possibly_addable_constraints<LhsInSpan, RhsInSpan, OutSpan>,
51 typename OutSpan::reference,
56 operator()(LhsInSpan
const lhs_span, RhsInSpan
const rhs_span, OutSpan
const out_span, Transform transform)
const
59 std::is_nothrow_assignable<
60 typename OutSpan::reference,
66 if (lhs_span.empty()) {
69 auto const extents_array = mdspan_detail::to_array(lhs_span.extents());
71 for (
auto const& indices : arene::base::detail::make_index_permutation_range(extents_array)) {
73 out_span(indices) = transform(lhs_span(indices), rhs_span(indices));
85 elementwise_binary_transform_detail::elementwise_binary_transform_fn,
86 elementwise_binary_transform
#define ARENE_CPP14_INLINE_VARIABLE(type, name)
Emulates C++17's inline variable declarations for function objects.
Definition cpp14_inline.hpp:69
#define ARENE_PRECONDITION(condition)
Check that a precondition holds, and terminate the application if it does not.
Definition contract.hpp:150
Definition accumulate.hpp:37
typename invoke_result< Fn, Args... >::type invoke_result_t
The return type of a functor invoked with the specified arguments.
Definition is_invocable.hpp:271
constexpr bool is_nothrow_invocable_v
Determine if a functor type is no-throw invocable with the specified argument types.
typename constraints_impl::constraints< EnableIfs... >::type constraints
Helper used to express template constraints in a consistent way using std::enable_if_t.
Definition constraints.hpp:51
Definition accumulate.hpp:36
typename enable_if< Condition, Type >::type enable_if_t
Type alias to support constraining templates. Is an alias for the specified type if the Condition is ...
Definition enable_if.hpp:41