template<typename Scalar = int>
class libsemigroups::MinPlusTruncSemiring< Scalar >
Defined in matrix-class.hpp.
This class represents the min-plus truncated 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 an integral type. |
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}
\min\{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 min-plus truncated 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 |
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 min-plus semiring.
- Parameters
-
- Returns
- A value of type Scalar.
- Exceptions
- This function is noexcept and is guaranteed never to throw.
- Complexity
- Constant.