67 if(v.empty())
return zero();
68 return *std::max_element(v.begin(), v.end());
71 if(v.empty())
return one();
72 double s = std::accumulate(v.begin(), v.end(), 0.0);
73 double r = s -
static_cast<double>(v.size() - 1);
74 return r > 0.0 ? r : 0.0;
78 return x<=y ?
zero() : x;
Abstract semiring interface for provenance evaluation.
The Łukasiewicz fuzzy m-semiring over double.
virtual value_type monus(value_type x, value_type y) const override
Apply the monus (m-semiring difference) operation.
virtual value_type delta(value_type x) const override
Apply the operator.
virtual value_type plus(const std::vector< value_type > &v) const override
Apply the additive operation to a list of values.
virtual value_type one() const override
Return the multiplicative identity .
virtual value_type times(const std::vector< value_type > &v) const override
Apply the multiplicative operation to a list of values.
virtual bool absorptive() const override
Return true if this semiring is absorptive ( for all ).
virtual bool compatibleWithBooleanRewrite() const override
No semiring homomorphism BoolFunc(Y) →+* Lukasiewicz exists (the Łukasiewicz t-norm is not idempotent...
value_type parse_leaf(const char *v) const
virtual value_type zero() const override
Return the additive identity .
Abstract base class for (m-)semirings.