libsemigroups
Public Member Functions | List of all members
libsemigroups::NaturalSemiring Class Reference

This class implements the semiring consisting of \(\{0, 1, ..., t, t + 1, ..., t + p - 1\}\) for some threshold \(t\) and period \(p\) with operations addition and multiplication modulo the congruence \(t = t + p\). More...

#include <semiring.h>

Inheritance diagram for libsemigroups::NaturalSemiring:
Inheritance graph
Collaboration diagram for libsemigroups::NaturalSemiring:
Collaboration graph

Public Member Functions

 NaturalSemiring (int64_t t, int64_t p)
 Construct from threshold and period. More...
 
int64_t one () const override
 Return the integer 1. More...
 
int64_t period () const
 Returns the period of the semiring. More...
 
int64_t plus (int64_t x, int64_t y) const override
 Returns x + y modulo the congruence \(t = t + p\) where \(t\) and \(p\) are the threshold and period of the semiring, respectively. More...
 
int64_t prod (int64_t x, int64_t y) const override
 Returns x * y modulo the congruence \(t = t + p\) where \(t\) and \(p\) are the threshold and period of the semiring, respectively. More...
 
int64_t zero () const override
 Return the integer 0. More...
 
- Public Member Functions inherited from libsemigroups::SemiringWithThreshold
 SemiringWithThreshold (int64_t threshold)
 A class for semirings with a threshold. More...
 
int64_t threshold () const
 Returns the threshold of a semiring with threshold. More...
 
- Public Member Functions inherited from libsemigroups::Semiring< int64_t >
virtual ~Semiring ()
 A default destructor. More...
 

Additional Inherited Members

- Static Public Attributes inherited from libsemigroups::Semiring< int64_t >
static const int64_t INFTY
 Value representing \(\infty\). More...
 
static const int64_t MINUS_INFTY
 Value representing \(-\infty\). More...
 
static const int64_t UNDEFINED
 Value representing an undefined quantity. More...
 

Detailed Description

This class implements the semiring consisting of \(\{0, 1, ..., t, t + 1, ..., t + p - 1\}\) for some threshold \(t\) and period \(p\) with operations addition and multiplication modulo the congruence \(t = t + p\).

Constructor & Destructor Documentation

◆ NaturalSemiring()

libsemigroups::NaturalSemiring::NaturalSemiring ( int64_t  t,
int64_t  p 
)
inline

Construct from threshold and period.

This method constructs a semiring whose elements are \(\{0, 1, ..., t, t + 1, ..., t + p - 1\}\) with operations addition and multiplication modulo the congruence \(t = t + p\).

The parameter t should be greater than or equal to 0, and the parameter p must be strictly greater than 0, both which are asserted in the constructor.

Member Function Documentation

◆ one()

int64_t libsemigroups::NaturalSemiring::one ( ) const
inlineoverridevirtual

Return the integer 1.

Implements libsemigroups::Semiring< int64_t >.

◆ period()

int64_t libsemigroups::NaturalSemiring::period ( ) const
inline

Returns the period of the semiring.

◆ plus()

int64_t libsemigroups::NaturalSemiring::plus ( int64_t  x,
int64_t  y 
) const
inlineoverridevirtual

Returns x + y modulo the congruence \(t = t + p\) where \(t\) and \(p\) are the threshold and period of the semiring, respectively.

Implements libsemigroups::Semiring< int64_t >.

◆ prod()

int64_t libsemigroups::NaturalSemiring::prod ( int64_t  x,
int64_t  y 
) const
inlineoverridevirtual

Returns x * y modulo the congruence \(t = t + p\) where \(t\) and \(p\) are the threshold and period of the semiring, respectively.

Implements libsemigroups::Semiring< int64_t >.

◆ zero()

int64_t libsemigroups::NaturalSemiring::zero ( ) const
inlineoverridevirtual

Return the integer 0.

Implements libsemigroups::Semiring< int64_t >.


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