Regina 7.4 Calculation Engine
regina::GroupExpressionTerm Struct Reference

Represents a power of a generator in a group presentation. More...

#include <algebra/grouppresentation.h>

Public Member Functions

 GroupExpressionTerm ()=default
 Creates a new uninitialised term.
 
 GroupExpressionTerm (unsigned long gen, long exp)
 Creates a new term initialised to the given value.
 
 GroupExpressionTerm (const GroupExpressionTerm &)=default
 Creates a new term initialised to the given value.
 
GroupExpressionTermoperator= (const GroupExpressionTerm &)=default
 Makes this term identical to the given term.
 
bool operator== (const GroupExpressionTerm &) const =default
 Determines whether this and the given term contain identical data.
 
std::strong_ordering operator<=> (const GroupExpressionTerm &) const =default
 Compares two terms lexicographically.
 
GroupExpressionTerm inverse () const
 Returns the inverse of this term.
 
bool operator+= (const GroupExpressionTerm &other)
 Attempts to merge this term with the given term.
 

Public Attributes

unsigned long generator
 The number that identifies the generator in this term.
 
long exponent
 The exponent to which the generator is raised.
 

Detailed Description

Represents a power of a generator in a group presentation.

These objects are small enough to pass by value and swap with std::swap(), with no need for any specialised move operations or swap functions.

Constructor & Destructor Documentation

◆ GroupExpressionTerm() [1/3]

regina::GroupExpressionTerm::GroupExpressionTerm ( )
default

Creates a new uninitialised term.

◆ GroupExpressionTerm() [2/3]

regina::GroupExpressionTerm::GroupExpressionTerm ( unsigned long gen,
long exp )
inline

Creates a new term initialised to the given value.

Parameters
genthe number that identifies the generator in the new term.
expthe exponent to which this generator is raised.

◆ GroupExpressionTerm() [3/3]

regina::GroupExpressionTerm::GroupExpressionTerm ( const GroupExpressionTerm & )
default

Creates a new term initialised to the given value.

Member Function Documentation

◆ inverse()

GroupExpressionTerm regina::GroupExpressionTerm::inverse ( ) const
inline

Returns the inverse of this term.

The inverse has the same generator but a negated exponent.

Note that this term will remain unchanged.

Returns
the inverse of this term.

◆ operator+=()

bool regina::GroupExpressionTerm::operator+= ( const GroupExpressionTerm & other)
inline

Attempts to merge this term with the given term.

If both terms have the same generator, the two exponents will be added and stored in this term. If the generators are different, this routine will do nothing.

Note that this term might be changed but the given term will remain unchanged.

Parameters
otherthe term to merge with this term.
Returns
true if the two terms were merged into this term, or false if the two terms have different generators.

◆ operator<=>()

std::strong_ordering regina::GroupExpressionTerm::operator<=> ( const GroupExpressionTerm & ) const
default

Compares two terms lexicographically.

Specifically, this operator imposes a total order on terms by comparing them lexicographically as (generator, exponent) pairs.

This generates all of the usual comparison operators, including <, <=, >, and >=.

Python
This spaceship operator x <=> y is not available, but the other comparison operators that it generates are available.
Returns
The result of the lexicographical comparison between this and the given term.

◆ operator=()

GroupExpressionTerm & regina::GroupExpressionTerm::operator= ( const GroupExpressionTerm & )
default

Makes this term identical to the given term.

Returns
a reference to this term.

◆ operator==()

bool regina::GroupExpressionTerm::operator== ( const GroupExpressionTerm & ) const
default

Determines whether this and the given term contain identical data.

Returns
true if and only if this and the given term have both the same generator and exponent.

Member Data Documentation

◆ exponent

long regina::GroupExpressionTerm::exponent

The exponent to which the generator is raised.

◆ generator

unsigned long regina::GroupExpressionTerm::generator

The number that identifies the generator in this term.


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