fix(math): fix nested expressions
This commit is contained in:
@@ -18,7 +18,7 @@ struct unary_expression : expression_tag {
|
||||
|
||||
constexpr auto shape() const { return expr.shape(); }
|
||||
|
||||
auto eval(std::size_t index) { return Op{}(expr.coeff(index)); }
|
||||
auto coeff(std::size_t index) const { return Op{}(expr.coeff(index)); }
|
||||
};
|
||||
|
||||
template <typename L, typename R, typename Op>
|
||||
@@ -32,7 +32,7 @@ struct binary_expression : expression_tag {
|
||||
|
||||
constexpr auto shape() const { return Op::shape(lhs, rhs); }
|
||||
|
||||
auto eval(std::size_t index) { return Op{}(index, lhs.coeff(index), as_operand(rhs)); }
|
||||
auto coeff(std::size_t index) const { return Op{}(index, lhs.coeff(index), as_operand(rhs)); }
|
||||
private:
|
||||
template <typename T>
|
||||
static decltype(auto) as_operand(T&& value) {
|
||||
|
||||
@@ -199,7 +199,7 @@ public:
|
||||
}
|
||||
|
||||
for (std::size_t i = 0; i < view().size(); ++i) {
|
||||
m_items[i] = std::forward<E>(expr).eval(i);
|
||||
m_items[i] = std::forward<E>(expr).coeff(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user