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

Defined in matrix.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
Scalarthe type of the elements of the semiring. This must be a signed integer type (defaults to int).

Public Member Functions

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

◆ MaxPlusTruncSemiring() [1/4]

template<typename Scalar = int>
MaxPlusTruncSemiring ( )
delete

Deleted default constructor.

◆ MaxPlusTruncSemiring() [2/4]

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

Default copy constructor.

◆ MaxPlusTruncSemiring() [3/4]

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

Default move constructor.

◆ MaxPlusTruncSemiring() [4/4]

template<typename Scalar = int>
MaxPlusTruncSemiring ( 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>
MaxPlusTruncSemiring & operator= ( MaxPlusTruncSemiring< Scalar > && )
defaultnoexcept

Default move assignment operator.

◆ operator=() [2/2]

template<typename Scalar = int>
MaxPlusTruncSemiring & operator= ( MaxPlusTruncSemiring< 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} \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
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

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
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 max-plus semiring.

Returns
The additive identity in a truncated max-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 max-plus semiring.

Returns
The additive identity in a truncated max-plus semiring (the value NEGATIVE_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 MaxPlusTruncSemiring 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: