libsemigroups
|
This class implements the semiring consisting of \(\{0, 1, ..., t, t + 1, ..., t + p - 1\}\) for some threshold \(t\) and period \(p\) with operations addition and multiplication modulo the congruence \(t = t + p\). More...
#include <semiring.h>
Public Member Functions | |
NaturalSemiring (int64_t t, int64_t p) | |
Construct from threshold and period. More... | |
int64_t | one () const override |
Return the integer 1. More... | |
int64_t | period () const |
Returns the period of the semiring. More... | |
int64_t | plus (int64_t x, int64_t y) const override |
Returns x + y modulo the congruence \(t = t + p\) where \(t\) and \(p\) are the threshold and period of the semiring, respectively. More... | |
int64_t | prod (int64_t x, int64_t y) const override |
Returns x * y modulo the congruence \(t = t + p\) where \(t\) and \(p\) are the threshold and period of the semiring, respectively. More... | |
int64_t | zero () const override |
Return the integer 0. More... | |
![]() | |
SemiringWithThreshold (int64_t threshold) | |
A class for semirings with a threshold. More... | |
int64_t | threshold () const |
Returns the threshold of a semiring with threshold. More... | |
![]() | |
virtual | ~Semiring () |
A default destructor. More... | |
Additional Inherited Members | |
![]() | |
static const int64_t | INFTY |
Value representing \(\infty\). More... | |
static const int64_t | MINUS_INFTY |
Value representing \(-\infty\). More... | |
static const int64_t | UNDEFINED |
Value representing an undefined quantity. More... | |
This class implements the semiring consisting of \(\{0, 1, ..., t, t + 1, ..., t + p - 1\}\) for some threshold \(t\) and period \(p\) with operations addition and multiplication modulo the congruence \(t = t + p\).
|
inline |
Construct from threshold and period.
This method constructs a semiring whose elements are \(\{0, 1, ..., t, t + 1, ..., t + p - 1\}\) with operations addition and multiplication modulo the congruence \(t = t + p\).
The parameter t
should be greater than or equal to 0, and the parameter p
must be strictly greater than 0, both which are asserted in the constructor.
|
inlineoverridevirtual |
Return the integer 1.
Implements libsemigroups::Semiring< int64_t >.
|
inline |
Returns the period of the semiring.
|
inlineoverridevirtual |
Returns x
+ y
modulo the congruence \(t = t + p\) where \(t\) and \(p\) are the threshold and period of the semiring, respectively.
Implements libsemigroups::Semiring< int64_t >.
|
inlineoverridevirtual |
Returns x
* y
modulo the congruence \(t = t + p\) where \(t\) and \(p\) are the threshold and period of the semiring, respectively.
Implements libsemigroups::Semiring< int64_t >.
|
inlineoverridevirtual |
Return the integer 0.
Implements libsemigroups::Semiring< int64_t >.