Defines a representation of a map between two sets of words. More...
#include <Map.h>
Public Member Functions | |
Map (int domain_gens, int range_gens) | |
Default constructor. | |
Map (int domain_gens, int range_gens, const vector< Word > &generatingImages) | |
Constructor. Creates a map defined by the images of an alphabet. | |
Map (const FiniteAlphabet &domain_alph, const FiniteAlphabet &range_alph) | |
Constructor. Creates a trivial map. | |
Map (const FiniteAlphabet &domain_alph, const FiniteAlphabet &range_alph, const vector< Word > &generatingImages) | |
Constructor. Creates a map defined by the images of an alphabet. | |
bool | operator== (const Map &m) const |
Comparison operator. | |
int | domainSize () const |
Returns the size of the domain's alphabet. | |
const FiniteAlphabet & | domainAlphabet () const |
Returns domain's alphabet. | |
int | rangeSize () const |
Returns the size of the range's alphabet. | |
const FiniteAlphabet & | rangeAlphabet () const |
Returns range's alphabet. | |
const vector< Word > & | generatingImages () const |
Returns the vector of images. | |
Word | generatingImages (int i) const |
Return the image of the ith letter. | |
void | setGeneratingImages (const vector< Word > gi) |
Sets or modifies generating images. | |
void | setGeneratingImages (int i, const Word &e) |
Assigns to the i-th (0-based) generating image. | |
Word | imageOf (const Word &w) const |
Compute the image of a word. | |
Map | operator| (const Map &secondMap) |
Map composition operator. | |
void | printOn (ostream &ostr) const |
Stream output. | |
void | readFrom (istream &in) |
Stream input. | |
Private Member Functions | |
char | readChar (istream &in) const |
Private Attributes | |
int | theDomain |
int | theRange |
vector< Word > | theGeneratingImages |
FiniteAlphabet | theDomainAlphabet |
FiniteAlphabet | theRangeAlphabet |
Friends | |
Map | composition (const Map &firstMap, const Map &secondMap) |
Map-theoretic composition. | |
ostream & | operator<< (ostream &out, const Map &m) |
Stream output operator. | |
istream & | operator>> (istream &in, Map &m) |
Stream input operator. |
Defines a representation of a map between two sets of words.
Both the domain and the range of a map are defined by finite alphabets.
Definition at line 22 of file Map.h.
Map::Map | ( | int | domain_gens, | |
int | range_gens | |||
) | [inline] |
Default constructor.
Constructor. Creates a trivial map.
If no images of letters of the domain are specified the map, by default, becomes the trivial map, i.e. the map mapping everything to the identity.
domain_gens | - the size of the domain's alphabet | |
range_gens | - the size of the range's alphabet |
Map::Map | ( | int | domain_gens, | |
int | range_gens, | |||
const vector< Word > & | generatingImages | |||
) | [inline] |
Constructor. Creates a map defined by the images of an alphabet.
Constructs a map, given a domain and range group, and images for the generators of the domain
domain_gens | - the size of the domain's alphabet | |
range_gens | - the size of the range's alphabet | |
generatingImages | - vector of images of letters of the domain. |
Definition at line 60 of file Map.h.
References msgs::error().
Map::Map | ( | const FiniteAlphabet & | domain_alph, | |
const FiniteAlphabet & | range_alph | |||
) | [inline] |
Constructor. Creates a trivial map.
If no images of letters of the domain are specified the map, by default, becomes the trivial map, i.e. the map mapping everything to the identity.
domain_alph | - alphabet of the domain | |
range_alph | - alphabet of the range |
Map::Map | ( | const FiniteAlphabet & | domain_alph, | |
const FiniteAlphabet & | range_alph, | |||
const vector< Word > & | generatingImages | |||
) | [inline] |
Constructor. Creates a map defined by the images of an alphabet.
Constructs a map, given a domain and range group, and images for the generators of the domain
domain_alph | - alphabet of the domain | |
range_alph | - alphabet of the range | |
generatingImages | - vector of images of letters of the domain. |
Definition at line 95 of file Map.h.
References msgs::error(), and theDomain.
const FiniteAlphabet& Map::domainAlphabet | ( | ) | const [inline] |
int Map::domainSize | ( | ) | const [inline] |
Word Map::generatingImages | ( | int | i | ) | const [inline] |
Return the image of the ith letter.
Definition at line 149 of file Map.h.
References msgs::error(), theDomain, and theGeneratingImages.
const vector<Word>& Map::generatingImages | ( | ) | const [inline] |
Returns the vector of images.
Definition at line 146 of file Map.h.
References theGeneratingImages.
Referenced by __gnu_cxx::map_hash::operator()().
Compute the image of a word.
Takes a formal word in the generators of domain and evaluates its `image' in range. The image is computed as follows. Let input word where Domain and Range be the image of the letter x
, then image of w
-
w | - a word in the domain |
w
. bool Map::operator== | ( | const Map & | m | ) | const [inline] |
Comparison operator.
Two maps are equal if the sizes of domains and ranges coincide respectively and images are defined by the same words.
Definition at line 121 of file Map.h.
References theDomain, theGeneratingImages, and theRange.
Map composition operator.
See composition( ... ) for details.
Definition at line 218 of file Map.h.
References composition.
void Map::printOn | ( | ostream & | ostr | ) | const |
Stream output.
const FiniteAlphabet& Map::rangeAlphabet | ( | ) | const [inline] |
int Map::rangeSize | ( | ) | const [inline] |
char Map::readChar | ( | istream & | in | ) | const [private] |
void Map::readFrom | ( | istream & | in | ) |
Stream input.
void Map::setGeneratingImages | ( | int | i, | |
const Word & | e | |||
) | [inline] |
Assigns to the i-th (0-based) generating image.
i | - the index of a letter | |
e | - the new image |
Definition at line 170 of file Map.h.
References msgs::error(), theDomain, and theGeneratingImages.
void Map::setGeneratingImages | ( | const vector< Word > | gi | ) | [inline] |
Sets or modifies generating images.
Definition at line 157 of file Map.h.
References msgs::error(), theDomain, and theGeneratingImages.
Map-theoretic composition.
Returns the composition of two maps
firstMap | - the first map | |
secondMap | - the second map |
secondMap
(firstMap
) Referenced by operator|().
ostream& operator<< | ( | ostream & | out, | |
const Map & | m | |||
) | [friend] |
istream& operator>> | ( | istream & | in, | |
Map & | m | |||
) | [friend] |
int Map::theDomain [private] |
Definition at line 254 of file Map.h.
Referenced by domainSize(), generatingImages(), Map(), operator==(), and setGeneratingImages().
FiniteAlphabet Map::theDomainAlphabet [private] |
Definition at line 258 of file Map.h.
Referenced by domainAlphabet().
vector<Word> Map::theGeneratingImages [private] |
Definition at line 256 of file Map.h.
Referenced by generatingImages(), operator==(), and setGeneratingImages().
int Map::theRange [private] |
Definition at line 255 of file Map.h.
Referenced by operator==(), and rangeSize().
FiniteAlphabet Map::theRangeAlphabet [private] |
Definition at line 259 of file Map.h.
Referenced by rangeAlphabet().