libsemigroups  v3.0.0
C++ library for semigroups and monoids
Loading...
Searching...
No Matches
MinPlusTruncSemiring< Scalar >
template<typename Scalar = int>
class libsemigroups::MinPlusTruncSemiring< Scalar >

Defined in matrix.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
Scalarthe type of the elements of the semiring. This must be an integral type.

Public Member Functions

 MinPlusTruncSemiring ()=delete
 Deleted default constructor.
 
 MinPlusTruncSemiring (MinPlusTruncSemiring &&) noexcept=default
 Default move constructor.
 
 MinPlusTruncSemiring (MinPlusTruncSemiring const &) noexcept=default
 Default copy constructor.
 
 MinPlusTruncSemiring (Scalar threshold)
 Construct from threshold.
 
MinPlusTruncSemiringoperator= (MinPlusTruncSemiring &&) noexcept=default
 Default move assignment operator.
 
MinPlusTruncSemiringoperator= (MinPlusTruncSemiring const &) noexcept=default
 Default copy assignment operator.
 
Scalar plus_no_checks (Scalar x, Scalar y) const noexcept
 Addition in a truncated min-plus semiring.
 
Scalar product_no_checks (Scalar x, Scalar y) const noexcept
 Multiplication in a truncated min-plus 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.
 

Constructor & Destructor Documentation

◆ MinPlusTruncSemiring() [1/4]

template<typename Scalar = int>
MinPlusTruncSemiring ( )
delete

Deleted default constructor.

◆ MinPlusTruncSemiring() [2/4]

template<typename Scalar = int>
MinPlusTruncSemiring ( MinPlusTruncSemiring< Scalar > const & )
defaultnoexcept

Default copy constructor.

◆ MinPlusTruncSemiring() [3/4]

template<typename Scalar = int>
MinPlusTruncSemiring ( MinPlusTruncSemiring< Scalar > && )
defaultnoexcept

Default move constructor.

◆ MinPlusTruncSemiring() [4/4]

template<typename Scalar = int>
MinPlusTruncSemiring ( Scalar threshold)
inlineexplicit

Construct from threshold.

Parameters
thresholdthe threshold.
Exceptions
LibsemigroupsExceptionif threshold is less than zero.
Complexity
Constant.

Member Function Documentation

◆ operator=() [1/2]

template<typename Scalar = int>
MinPlusTruncSemiring & operator= ( MinPlusTruncSemiring< Scalar > && )
defaultnoexcept

Default move assignment operator.

◆ operator=() [2/2]

template<typename Scalar = int>
MinPlusTruncSemiring & operator= ( MinPlusTruncSemiring< Scalar > const & )
defaultnoexcept

Default copy assignment operator.

◆ plus_no_checks()

template<typename Scalar = int>
Scalar plus_no_checks ( Scalar x,
Scalar y ) const
inlinenoexcept

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
xscalar.
yscalar.
Returns
A value of type Scalar.
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.

◆ product_no_checks()

template<typename Scalar = int>
Scalar product_no_checks ( Scalar x,
Scalar y ) const
inlinenoexcept

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
xscalar.
yscalar.
Returns
A value of type Scalar.
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.

◆ scalar_one()

template<typename Scalar = int>
static constexpr Scalar scalar_one ( )
inlinestaticconstexprnoexcept

This function returns the multiplicative identity in a truncated min-plus semiring.

Returns
The multiplicative identity in a truncated min-plus semiring (the value 0).
Exceptions
This function is noexcept and is guaranteed never to throw.

◆ scalar_zero()

template<typename Scalar = int>
static constexpr Scalar scalar_zero ( )
inlinestaticconstexprnoexcept

This function returns the additive identity in a truncated min-plus semiring.

Returns
The additive identity in a truncated min-plus semiring (the value POSITIVE_INFINITY).
Exceptions
This function is noexcept and is guaranteed never to throw.

◆ threshold()

template<typename Scalar = int>
Scalar threshold ( ) const
inlinenoexcept

Returns the threshold value used to construct MinPlusTruncSemiring instance.

Returns
A value of type Scalar.
Exceptions
This function is noexcept and is guaranteed never to throw.
Complexity
Constant.

The documentation for this class was generated from the following file: