12 typename LHS,
typename RHS,
13 template <
typename, my_
size_t,
typename>
class Op>
17 static_assert(is_same_v<typename LHS::value_type, typename RHS::value_type>,
18 "BinaryExpr: LHS and RHS must have the same value_type");
20#ifdef COMPILETIME_CHECK_DIMENSIONS_COUNT_MISMATCH
22 static_assert(LHS::NumDims == RHS::NumDims,
23 "BinaryExpr: number of dimensions mismatch");
25#ifdef COMPILETIME_CHECK_DIMENSIONS_SIZE_MISMATCH
27 static_assert(dims_match<LHS::NumDims>(LHS::Dim, RHS::Dim),
28 "BinaryExpr: there is at least one dimension mismatch");
46 const LHS &
lhs() const noexcept {
return _lhs; }
47 const RHS &
rhs() const noexcept {
return _rhs; }
49 template <
typename Output>
52 return _lhs.may_alias(output) || _rhs.may_alias(output);
55 template <my_
size_t length>
58 using T = std::decay_t<
decltype(_lhs(indices))>;
59 return Op<T, 0, GENERICARCH>::apply(_lhs(indices), _rhs(indices));
62 template <
typename T, my_
size_t Bits,
typename Arch>
65 return Op<T, Bits, Arch>::apply(
66 _lhs.template evalu<T, Bits, Arch>(flat),
67 _rhs.template evalu<T, Bits, Arch>(flat));
70 template <
typename T, my_
size_t Bits,
typename Arch>
73 return Op<T, Bits, Arch>::apply(
74 _lhs.template logical_evalu<T, Bits, Arch>(logical_flat),
75 _rhs.template logical_evalu<T, Bits, Arch>(logical_flat));
81 return _lhs.getNumDims();
87 return _lhs.getDim(i);
92 return _lhs.getTotalSize();
Definition BinaryExpr.h:15
static constexpr my_size_t TotalSize
Definition BinaryExpr.h:40
Op< T, Bits, Arch >::type evalu(my_size_t flat) const noexcept
Definition BinaryExpr.h:63
BinaryExpr(const LHS &lhs, const RHS &rhs)
Definition BinaryExpr.h:44
bool may_alias(const Output &output) const noexcept
Definition BinaryExpr.h:50
my_size_t getTotalSize() const noexcept
Definition BinaryExpr.h:90
my_size_t getNumDims() const noexcept
Definition BinaryExpr.h:79
my_size_t getDim(my_size_t i) const
Definition BinaryExpr.h:85
const LHS & lhs() const noexcept
Definition BinaryExpr.h:46
typename LHS::Layout Layout
Definition BinaryExpr.h:42
typename LHS::value_type value_type
Definition BinaryExpr.h:41
static constexpr my_size_t NumDims
Definition BinaryExpr.h:38
Op< T, Bits, Arch >::type logical_evalu(my_size_t logical_flat) const noexcept
Definition BinaryExpr.h:71
static constexpr const my_size_t * Dim
Definition BinaryExpr.h:39
const RHS & rhs() const noexcept
Definition BinaryExpr.h:47
auto operator()(my_size_t(&indices)[length]) const noexcept
Definition BinaryExpr.h:56
Global configuration for the tesseract tensor library.
#define my_size_t
Size/index type used throughout the library.
Definition config.h:126