libsemigroups
|
Abstract base class for elements using a vector to store their defining data. More...
#include <elements.h>
Public Member Functions | |
ElementWithVectorData () | |
A constructor. More... | |
ElementWithVectorData (std::vector< TValueType > *vector) | |
A constructor. More... | |
ElementWithVectorData (std::vector< TValueType > const &vector) | |
A constructor. More... | |
TValueType | at (size_t pos) const |
Returns the pos entry in the vector containing the defining data. More... | |
std::vector< TValueType >::iterator | begin () const |
Returns an iterator. More... | |
std::vector< TValueType >::iterator | cbegin () const |
Returns a const iterator. More... | |
std::vector< TValueType >::iterator | cend () const |
Returns a const iterator. More... | |
void | copy (Element const *x) override |
Copy another Element into this . More... | |
std::vector< TValueType >::iterator | end () const |
Returns an iterator. More... | |
bool | operator< (Element const &that) const override |
Returns true if this is less than that . More... | |
bool | operator== (Element const &that) const override |
Returns true if this equals that . More... | |
TValueType | operator[] (size_t pos) const |
Returns the pos entry in the vector containing the defining data. More... | |
Element * | really_copy (size_t increase_deg_by=0) const override |
Returns a pointer to a copy of this . More... | |
void | really_delete () override |
Deletes the defining data of an ElementWithVectorData. More... | |
void | swap (Element *x) override |
Swap another Element with this . More... | |
![]() | |
Element (elm_t type=Element::elm_t::NOT_RWSE) | |
A constructor. More... | |
virtual | ~Element () |
A default destructor. More... | |
virtual size_t | complexity () const =0 |
Returns the approximate time complexity of multiplying two Element objects in a given subclass. More... | |
virtual size_t | degree () const =0 |
Returns the degree of an Element. More... | |
elm_t | get_type () const |
Returns the type libsemigroups::Element::elm_t of an Element object. More... | |
size_t | hash_value () const |
Return the hash value of an Element. More... | |
virtual Element * | identity () const =0 |
Returns a new copy of the identity element. More... | |
virtual void | redefine (Element const *x, Element const *y) |
Multiplies x and y and stores the result in this . More... | |
virtual void | redefine (Element const *x, Element const *y, size_t const &thread_id) |
Multiplies x and y and stores the result in this . More... | |
Static Protected Member Functions | |
template<typename T > | |
static size_t | vector_hash (std::vector< T > const *vec) |
Returns a hash value for a vector provided there is a specialization of std::hash for the template type T . More... | |
Protected Attributes | |
std::vector< TValueType > * | _vector |
The vector containing the defining data of this . More... | |
Additional Inherited Members | |
![]() | |
enum | elm_t { RWSE = 0, NOT_RWSE = 1 } |
This enum contains some different types of Element. More... | |
![]() | |
virtual void | cache_hash_value () const =0 |
Calculate and cache a hash value. More... | |
void | reset_hash_value () const |
Reset the cached value used by Element::hash_value. More... | |
![]() | |
static size_t const | UNDEFINED = std::numeric_limits<size_t>::max() |
UNDEFINED value. More... | |
Abstract base class for elements using a vector to store their defining data.
The template parameter TValueType
is the type entries in the vector containing the defining data.
The template parameter TSubclass
is the subclass of ElementWithVectorData used by certain methods to construct new instances of subclasses of ElementWithVectorData.
For example, Transformation<u_int128_t> is a subclass of ElementWithVectorData<u_int128_t, Transformation<u_int128_t>> so that when the identity method in this class is called it returns a Transformation and not an ElementWithVectorData.
|
inline |
A constructor.
Returns an object with an uninitialised vector.
|
inlineexplicit |
A constructor.
The parameter vector
should be a pointer to defining data of the element.
Returns an object whose defining data is stored in vector
, which is not copied, and is deleted using Element::really_delete.
|
inlineexplicit |
A constructor.
The parameter vector
should be a const reference to defining data of the element.
Returns an object whose defining data is a copy of vector
.
|
inline |
Returns the pos
entry in the vector containing the defining data.
This method returns the pos
entry in the vector used to construct this
.
|
inline |
Returns an iterator.
This method returns an iterator pointing at the first entry in the vector that is the underlying defining data of this
.
|
inline |
Returns a const iterator.
This method returns a const_iterator pointing at the first entry in the vector that is the underlying defining data of this
.
|
inline |
Returns a const iterator.
This method returns a const iterator referring to the past-the-end element of the vector that is the underlying defining data of this
.
|
inlineoverridevirtual |
Copy another Element into this
.
This method copies x
into this
by changing this
in-place. This method asserts that the degrees of this
and x
are equal and then replaces the underlying vector of this
with the underlying vector of x
. Any method overriding this one must define _hash_value correctly or call Element::reset_hash_value on this
.
Implements libsemigroups::Element.
|
inline |
Returns an iterator.
This method returns an iterator referring to the past-the-end element of the vector that is the underlying defining data of this
.
|
inlineoverridevirtual |
Returns true
if this
is less than that
.
This method defines a total order on the set of objects in ElementWithVectorData of a given Element::degree, which is the short-lex order.
Implements libsemigroups::Element.
|
inlineoverridevirtual |
Returns true
if this
equals that
.
This method checks that the underlying vectors of this
and that
are equal.
Implements libsemigroups::Element.
|
inline |
Returns the pos
entry in the vector containing the defining data.
This method returns the pos
entry in the vector used to construct this
. No checks are performed that pos
in within the bounds of this vector.
|
inlineoverridevirtual |
Returns a pointer to a copy of this
.
The size of the vector containing the defining data of this
will be increased by increase_deg_by
. If increase_deg_by
is not 0, then this method must be overridden by any subclass of ElementWithVectorData since there is no way of knowing how a subclass is defined by the data in the vector.
Implements libsemigroups::Element.
Reimplemented in libsemigroups::MatrixOverSemiringBase< TValueType, TSubclass >, libsemigroups::MatrixOverSemiringBase< bool, BooleanMat >, libsemigroups::MatrixOverSemiringBase< TValueType, MatrixOverSemiring< TValueType > >, and libsemigroups::MatrixOverSemiringBase< int64_t, ProjectiveMaxPlusMatrix >.
|
inlineoverridevirtual |
Deletes the defining data of an ElementWithVectorData.
Implements libsemigroups::Element.
|
inlineoverridevirtual |
Swap another Element with this
.
This method swaps the defining data of x
and this
. This method asserts that the degrees of this
and x
are equal and then swaps the underlying vector of this
with the underlying vector of x
. Any method overriding should swap the hash_value of this
and x
, or call Element::reset_hash_value on this
and x
.
Implements libsemigroups::Element.
|
inlinestaticprotected |
Returns a hash value for a vector provided there is a specialization of std::hash for the template type T
.
|
protected |
The vector containing the defining data of this
.
The actual data defining of this
is stored in _vector.