diff --git a/include/cenet/math/expr.hpp b/include/cenet/math/expr.hpp index 0e0da6a..36bdad1 100644 --- a/include/cenet/math/expr.hpp +++ b/include/cenet/math/expr.hpp @@ -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 @@ -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 static decltype(auto) as_operand(T&& value) { diff --git a/include/cenet/math/tensor.hpp b/include/cenet/math/tensor.hpp index 812e18f..c63e901 100644 --- a/include/cenet/math/tensor.hpp +++ b/include/cenet/math/tensor.hpp @@ -199,7 +199,7 @@ public: } for (std::size_t i = 0; i < view().size(); ++i) { - m_items[i] = std::forward(expr).eval(i); + m_items[i] = std::forward(expr).coeff(i); } }