Regina Calculation Engine
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
regina::AbelianGroup Class Reference

Represents a finitely generated abelian group. More...

#include <algebra/abeliangroup.h>

Inheritance diagram for regina::AbelianGroup:
regina::ShortOutput< AbelianGroup, true > regina::Output< AbelianGroup, supportsUtf8 >

Public Member Functions

 AbelianGroup ()
 Creates a new trivial group. More...
 
 AbelianGroup (const AbelianGroup &cloneMe)=default
 Creates a clone of the given group. More...
 
 AbelianGroup (const MatrixInt &M, const MatrixInt &N)
 Creates an abelian group as the homology of a chain complex. More...
 
 AbelianGroup (const MatrixInt &M, const MatrixInt &N, const Integer &p)
 Creates an abelian group as the homology of a chain complex, using mod-p coefficients. More...
 
void addRank (int extraRank=1)
 Increments the rank of the group by the given integer. More...
 
void addTorsionElement (const Integer &degree, unsigned mult=1)
 Adds the given torsion element to the group. More...
 
void addTorsionElement (unsigned long degree, unsigned mult=1)
 Adds the given torsion element to the group. More...
 
void addTorsionElements (const std::multiset< Integer > &torsion)
 Adds the given set of torsion elements to this group. More...
 
void addGroup (const MatrixInt &presentation)
 Adds the abelian group defined by the given presentation to this group. More...
 
void addGroup (const AbelianGroup &group)
 Adds the given abelian group to this group. More...
 
unsigned rank () const
 Returns the rank of the group. More...
 
unsigned torsionRank (const Integer &degree) const
 Returns the rank in the group of the torsion term of given degree. More...
 
unsigned torsionRank (unsigned long degree) const
 Returns the rank in the group of the torsion term of given degree. More...
 
size_t countInvariantFactors () const
 Returns the number of invariant factors that describe the torsion elements of this group. More...
 
const IntegerinvariantFactor (size_t index) const
 Returns the given invariant factor describing the torsion elements of this group. More...
 
bool isTrivial () const
 Determines whether this is the trivial (zero) group. More...
 
bool isZ () const
 Determines whether this is the infinite cyclic group (Z). More...
 
bool isZn (unsigned long n) const
 Determines whether this is the non-trivial cyclic group on the given number of elements. More...
 
bool operator== (const AbelianGroup &other) const
 Determines whether this and the given abelian group are isomorphic. More...
 
bool operator!= (const AbelianGroup &other) const
 Determines whether this and the given abelian group are non-isomorphic. More...
 
AbelianGroupoperator= (const AbelianGroup &cloneMe)=default
 Sets this to be a clone of the given group. More...
 
void writeXMLData (std::ostream &out) const
 Writes a chunk of XML containing this abelian group. More...
 
void writeTextShort (std::ostream &out, bool utf8=false) 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...
 

Protected Member Functions

void replaceTorsion (const MatrixInt &matrix)
 Replaces the torsion elements of this group with those in the abelian group represented by the given Smith normal form presentation matrix. More...
 

Protected Attributes

unsigned rank_
 The rank of the group (the number of Z components). More...
 
std::multiset< IntegerinvariantFactors
 The invariant factors d0,...,dn as described in the AbelianGroup notes. More...
 

Detailed Description

Represents a finitely generated abelian group.

The torsion elements of the group are stored in terms of their invariant factors. For instance, Z_2+Z_3 will appear as Z_6, and Z_2+Z_2+Z_3 will appear as Z_2+Z_6.

In general the factors will appear as Z_d0+...+Z_dn, where the invariant factors di are all greater than 1 and satisfy d0|d1|...|dn. Note that this representation is unique.

Todo:
Optimise (long-term): Look at using sparse matrices for storage of SNF and the like.

Member Function Documentation

◆ detail()

std::string regina::Output< AbelianGroup , supportsUtf8 >::detail
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.

Returns
a detailed text representation of this object.

◆ str()

std::string regina::Output< AbelianGroup , supportsUtf8 >::str
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.

Python:\n In addition to str(), this is also used as the
Python "stringification" function str().
Returns
a short text representation of this object.

◆ utf8()

std::string regina::Output< AbelianGroup , supportsUtf8 >::utf8
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.

Returns
a short text representation of this object.

◆ writeTextLong()

void regina::ShortOutput< AbelianGroup , supportsUtf8 >::writeTextLong ( std::ostream &  out) const
inlineinherited

A default implementation for detailed output.

This routine simply calls T::writeTextShort() and appends a final newline.

Python:\n Not present.
Parameters
outthe output stream to which to write.

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

Copyright © 1999-2020, The Regina development team
This software is released under the GNU General Public License, with some additional permissions; see the source code for details.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@maths.uq.edu.au).