Class Sum¶
Defined in File expr.hpp
Inheritance Relationships¶
Base Type¶
public sequant::Expr
(Class Expr)
Class Documentation¶
-
class Sum : public sequant::Expr¶
sum of zero or more summands
Sum is associative and is flattened automatically.
Public Functions
-
Sum() = default¶
-
virtual ~Sum() = default¶
-
inline Sum(ExprPtrList summands)¶
construct a Sum out of zero or more summands
- Parameters:
summands – an initializer list of summands
-
template<typename Iterator>
inline Sum(Iterator begin, Iterator end)¶ construct a Sum out of a range of summands
- Parameters:
begin – the begin iterator
end – the end iterator
-
template<typename Range, typename = std::enable_if_t<meta::is_range_v<std::decay_t<Range>> && !meta::is_same_v<Range, ExprPtrList>>>
inline explicit Sum(Range &&rng)¶ construct a Sum out of a range of summands
- Parameters:
rng – a range
-
inline Sum &prepend(ExprPtr summand)¶
prepend a summand to the sum
- Parameters:
summand – the summand
-
inline const auto &summands() const¶
Summands accessor.
-
inline const ExprPtr &summand(size_t i) const¶
Summand accessor
- Parameters:
i – summand index
- Returns:
ith summand
-
inline ExprPtr take_n(size_t offset, size_t count) const¶
Takes the first
count
elements of the sum starting with elementoffset
-
template<typename Filter>
inline ExprPtr filter(Filter &&f) const¶ - Template Parameters:
Filter – a boolean predicate type, such
Filter(const ExprPtr&)
evaluates to true- Parameters:
f – an object of Filter type Selects elements {
e
} for whichf(e)
is true
-
inline bool empty() const¶
- Returns:
true if the number of factors is zero
-
inline virtual std::wstring to_latex() const override¶
- Returns:
the string representation of
this
in the LaTeX format
-
inline virtual std::wstring to_wolfram() const override¶
- Returns:
the string representation of
this
in the Wolfram Language format
-
inline virtual Expr::type_id_type type_id() const override¶
Computes and returns the derived type identifier
See also
Note
this function must be overridden in the derived class
- Returns:
the hash value for this Expr
-
inline virtual ExprPtr clone() const override¶
Note
- must be overridden in the derived class.
the default implementation throws an exception
- Returns:
a clone of this object, i.e. an object that is equal to
this
-
Sum() = default¶