template<typename Scalar = int>
class libsemigroups::MaxPlusTruncSemiring< Scalar >
Defined in matrix-class.hpp.
This class represents the truncated max-plus semiring consists of the integers \(\{0, \ldots , t\}\) for some value \(t\) (called the threshold of the semiring) and \(-\infty\). Instances of this class can be used to define the value of the threshold \(t\) at run time.
- Template Parameters
-
| Scalar | the type of the elements of the semiring. This must be a signed integer type (defaults to int). |
template<typename Scalar = int>
| Scalar plus_no_checks |
( |
Scalar | x, |
|
|
Scalar | y ) const |
|
noexcept |
Returns \(x \oplus y\) which is defined by
\[ x\oplus y =
\begin{cases}
\max\{x, y\} & \text{if } x \neq -\infty\text{ and }y \neq
-\infty
\\ \mbox{}
-\infty & \text{if } x = -\infty \text{ or }y = -\infty;
\end{cases}
\]
representing addition in the max-plus semiring (and its quotient).
- Parameters
-
- Returns
- A value of type Scalar.
- Exceptions
- This function is noexcept and is guaranteed never to throw.
- Complexity
- Constant.
template<typename Scalar = int>
| Scalar product_no_checks |
( |
Scalar | x, |
|
|
Scalar | y ) const |
|
noexcept |
This function returns \(x \otimes y\) which is defined by
\[ x\otimes y =
\begin{cases}
\min\{x + y, t\} & \text{if } x \neq -\infty\text{ and }y \neq
-\infty \\ \mbox{}
-\infty & \text{if } x = -\infty \text{ or }y = -\infty;
\end{cases}
\]
where \(t\) is the threshold; representing multiplication in the quotient of the max-plus semiring.
- Parameters
-
- Returns
- A value of type Scalar.
- Exceptions
- This function is noexcept and is guaranteed never to throw.
- Complexity
- Constant.