Regina Calculation Engine
|
Represents an expression involving generators from a group presentation or a free group. More...
#include <algebra/grouppresentation.h>
Public Member Functions | |
GroupExpression () | |
The terms that make up this expression. More... | |
GroupExpression (const GroupExpression &cloneMe) | |
Creates a new expression that is a clone of the given expression. More... | |
GroupExpression (const std::string &input, bool *valid=NULL) | |
Attempts to interpret the given input string as a word in a group. More... | |
GroupExpression & | operator= (const GroupExpression &cloneMe) |
Makes this expression a clone of the given expression. More... | |
bool | operator== (const GroupExpression &comp) const |
Equality operator. More... | |
bool | operator!= (const GroupExpression &comp) const |
Inequality operator. More... | |
std::list< GroupExpressionTerm > & | terms () |
Returns the list of terms in this expression. More... | |
const std::list< GroupExpressionTerm > & | terms () const |
Returns a constant reference to the list of terms in this expression. More... | |
size_t | countTerms () const |
Returns the number of terms in this expression. More... | |
size_t | wordLength () const |
Returns the length of the word, i.e. More... | |
bool | isTrivial () const |
Tests whether this is the trivial (unit) word. More... | |
void | erase () |
Erases all terms from this this word. More... | |
GroupExpressionTerm & | term (size_t index) |
Returns the term at the given index in this expression. More... | |
const GroupExpressionTerm & | term (size_t index) const |
Returns a constant reference to the term at the given index in this expression. More... | |
unsigned long | generator (size_t index) const |
Returns the generator corresonding to the term at the given index in this expression. More... | |
long | exponent (size_t index) const |
Returns the exponent corresonding to the term at the given index in this expression. More... | |
void | addTermFirst (const GroupExpressionTerm &term) |
Adds the given term to the beginning of this expression. More... | |
void | addTermFirst (unsigned long generator, long exponent) |
Adds the given term to the beginning of this expression. More... | |
void | addTermLast (const GroupExpressionTerm &term) |
Adds the given term to the end of this expression. More... | |
void | addTermLast (unsigned long generator, long exponent) |
Adds the given term to the end of this expression. More... | |
void | addTermsFirst (const GroupExpression &word) |
Multiplies this expression on the left by the given word. More... | |
void | addTermsLast (const GroupExpression &word) |
Multiplies this expression on the right by the given word. More... | |
bool | addStringFirst (const std::string &input) |
Multiplies this expression on the left by the word respresented by the given string. More... | |
bool | addStringLast (const std::string &input) |
Multiplies this expression on the right by the word respresented by the given string. More... | |
void | cycleRight () |
Cycles this word by moving the leftmost term around to the rightmost. More... | |
void | cycleLeft () |
Cycles this word by moving the rightmost term around to the leftmost. More... | |
GroupExpression * | inverse () const |
Returns a newly created expression that is the inverse of this expression. More... | |
void | invert () |
Inverts this expression. More... | |
GroupExpression * | power (long exponent) const |
Returns a newly created expression that is this expression raised to the given power. More... | |
bool | simplify (bool cyclic=false) |
Simplifies this expression. More... | |
bool | substitute (unsigned long generator, const GroupExpression &expansion, bool cyclic=false) |
Replaces every occurrence of the given generator with the given substite expression. More... | |
std::list< std::map< unsigned long, GroupExpressionTerm > > | relabellingsThisToOther (const GroupExpression &other, bool cyclic=false) const |
Determines whether or not one can relabel the generators in this word to obtain the given other word. More... | |
void | writeXMLData (std::ostream &out) const |
Writes a chunk of XML containing this expression. More... | |
std::string | toTeX () const |
Returns a TeX representation of this expression. More... | |
void | writeTeX (std::ostream &out) const |
Writes a TeX represesentation of this expression to the given output stream. More... | |
void | writeText (std::ostream &out, bool shortword=false, bool utf8=false) const |
Writes a text representation of this expression to the given output stream, using either numbered generators or alphabetic generators. More... | |
void | writeTextShort (std::ostream &out) const |
Writes a short text representation of this object to the given output stream. More... | |
void | writeTextLong (std::ostream &out) const |
A default implementation for detailed output. More... | |
std::string | str () const |
Returns a short text representation of this object. More... | |
std::string | utf8 () const |
Returns a short text representation of this object using unicode characters. More... | |
std::string | detail () const |
Returns a detailed text representation of this object. More... | |
Represents an expression involving generators from a group presentation or a free group.
An expression is represented as word, i.e, a sequence of powers of generators all of which are multiplied in order. Each power of a generator corresponds to an individual GroupExpressionTerm.
For instance, the expression g1^2 g3^-1 g6
contains the three terms g1^2
, g3^-1
and g6^1
in that order.
|
inherited |
Returns a detailed text representation of this object.
This text may span many lines, and should provide the user with all the information they could want. It should be human-readable, should not contain extremely long lines (which cause problems for users reading the output in a terminal), and should end with a final newline. There are no restrictions on the underlying character set.
|
inherited |
Returns a short text representation of this object.
This text should be human-readable, should fit on a single line, and should not end with a newline. Where possible, it should use plain ASCII characters.
__str__()
.
|
inherited |
Returns a short text representation of this object using unicode characters.
Like str(), this text should be human-readable, should fit on a single line, and should not end with a newline. In addition, it may use unicode characters to make the output more pleasant to read. This string will be encoded in UTF-8.
|
inlineinherited |
A default implementation for detailed output.
This routine simply calls T::writeTextShort() and appends a final newline.
out | the output stream to which to write. |