Class Sum¶
Defined in File sum.hpp
Nested Relationships¶
Nested Types¶
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>
inline explicit Sum(Range &&rng)¶ construct a Sum out of a range of summands
- Parameters:
rng – a range
-
inline explicit Sum(summands_type &&summands, move_only_tag)¶
construct a Sum by moving in the summands, no flattening is performed, but zeros will be omitted and constants added up
- Parameters:
summands – the summands to move in
-
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
countelements 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
thisin the LaTeX format
-
inline virtual std::wstring to_wolfram() const override¶
- Returns:
the string representation of
thisin 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
-
struct move_only_tag¶
tags ctor to move the summands directly
-
Sum() = default¶