![]() |
libsemigroups
v3.0.0
C++ library for semigroups and monoids
|
Defined in matrix.hpp
.
This class represents the ntp semiring consists of the integers \(\{0, 1, ..., t, t + 1, ..., t + p - 1\}\) for some \(t\) and \(p\) (called the threshold and period). Instances of this class can be used to define the value of the threshold \(t\) and period \(p\) at run time.
Scalar | the type of the elements of the semiring. |
Public Member Functions | |
NTPSemiring ()=delete | |
Deleted default constructor. | |
NTPSemiring (NTPSemiring &&)=default | |
Default move constructor. | |
NTPSemiring (NTPSemiring const &)=default | |
Default copy constructor. | |
NTPSemiring (Scalar t, Scalar p) | |
Construct from threshold and period. | |
NTPSemiring & | operator= (NTPSemiring &&)=default |
Default move assignment operator. | |
NTPSemiring & | operator= (NTPSemiring const &)=default |
Default copy assignment operator. | |
Scalar | period () const noexcept |
Get the period. | |
Scalar | plus_no_checks (Scalar x, Scalar y) const noexcept |
Addition in an ntp semiring. | |
Scalar | product_no_checks (Scalar x, Scalar y) const noexcept |
Multiplication in an ntp semiring. | |
Scalar | threshold () const noexcept |
Get the threshold. | |
Static Public Member Functions | |
static constexpr Scalar | scalar_one () noexcept |
Get the multiplicative identity. | |
static constexpr Scalar | scalar_zero () noexcept |
Get the additive identity. | |
|
delete |
Deleted default constructor.
|
default |
Default copy constructor.
|
default |
Default move constructor.
|
inline |
Construct from threshold and period.
t | the threshold ( \(t \geq 0\)). |
p | the period ( \(p > 0\)). |
LibsemigroupsException | if t is less than zero. |
LibsemigroupsException | if p is less than or equal to zero. |
|
default |
Default move assignment operator.
|
default |
Default copy assignment operator.
|
inlinenoexcept |
Returns the period value used to construct NTPSemiring instance.
Scalar
.noexcept
and is guaranteed never to throw.
|
inlinenoexcept |
This function returns \(x \oplus y\) which is defined by
\[ x\oplus y = \begin{cases} x + y & \text{if } x + y \leq t \\ \mbox{} t + ((x + y - t) \pmod{p}) & \text{if } x + y > t \end{cases} \]
where \(t\) is the threshold and \(p\) is the period; representing multiplication in the quotient of the semiring of natural numbers.
x | scalar ( \(0\leq x < t + p\)). |
y | scalar ( \(0\leq y < t + p\)). |
Scalar
.noexcept
and is guaranteed never to throw.
|
inlinenoexcept |
This function returns \(x \otimes y\) which is defined by
\[ x\otimes y = \begin{cases} xy & \text{if } xy \leq t \\ \mbox{} t + ((xy - t)\pmod{p}) & \text{if } xy > t \end{cases} \]
where \(t\) is the threshold and \(p\) is the period; representing multiplication in the quotient of the semiring of natural numbers.
x | scalar (0 <= x < threshold() + period() ). |
y | scalar (0 <= y < threshold() + period() ). |
Scalar
.noexcept
and is guaranteed never to throw.
|
inlinestaticconstexprnoexcept |
This function returns \(1\); representing the multiplicative identity of the quotient of the semiring of natural numbers.
0
).noexcept
and is guaranteed never to throw.
|
inlinestaticconstexprnoexcept |
This function returns \(0\) representing the additive identity of the quotient of the semiring of natural numbers.
Scalar
.noexcept
and is guaranteed never to throw.
|
inlinenoexcept |
Returns the threshold value used to construct NTPSemiring instance.
Scalar
.noexcept
and is guaranteed never to throw.