This class defines a chain map between two chain complexes. More...
#include <chains.h>
Public Member Functions | |
chainmap (const chaincomplex< euclidom > &domain, const chaincomplex< euclidom > &range) | |
The default constructor of a chain map between the two given chain complexes. | |
chainmap (const chainmap< euclidom > &c) | |
Copy constructor. | |
chainmap< euclidom > & | operator= (const chainmap< euclidom > &c) |
The assignment operator. | |
~chainmap () | |
The destructor. | |
int | dim () const |
Returns the dimension of the chain map. | |
const mmatrix< euclidom > & | operator[] (int i) const |
Returns the matrix of the chain map at the given level. | |
void | add (int q, int m, int n, euclidom e) |
Adds a coefficient to the selected matrix of the map: M_q [m, n] += e. | |
void | invert (void) |
Inverts the chain map. | |
void | compose (const chainmap< euclidom > &m1, const chainmap< euclidom > &m2) |
Composes two given chain maps. | |
outputstream & | show (outputstream &out, const char *maplabel="f", const char *xtxt=NULL, const char *ytxt=NULL, const int *level=NULL) const |
Writes the chain map to an output stream in the text format using specified labels for the map and elements in the domain and in the codomain of the map. | |
std::ostream & | show (std::ostream &out, const char *maplabel="f", const char *xtxt=NULL, const char *ytxt=NULL, const int *level=NULL) const |
Writes the chain map to an output stream in the text format using specified labels for the map and elements in the domain and in the codomain of the map. | |
void | take_homology (const chainmap< euclidom > &m, const chain< euclidom > *hom_domain, const chain< euclidom > *hom_range) |
Creates a chain map that represents the map induced in homology by the chain map between the two given chain complexes which have been previously transformed to the simple form. | |
outputstream & | show_homology (outputstream &out, const chain< euclidom > *hom_domain, const chain< euclidom > *hom_range, const int *level=NULL, const char *xtxt=NULL, const char *ytxt=NULL) const |
Writes to an output stream the map induced in homology. | |
std::ostream & | show_homology (std::ostream &out, const chain< euclidom > *hom_domain, const chain< euclidom > *hom_range, const int *level=NULL, const char *xtxt=NULL, const char *ytxt=NULL) const |
Writes to an output stream the map induced in homology. | |
Private Attributes | |
int | len |
The number of matrices (dimension of the chain map + 1). | |
mmatrix< euclidom > * | map |
The matrices in each dimension. |
This class defines a chain map between two chain complexes.
The chain complexes must exist and not change durign the existence of the chain map.
Definition at line 2950 of file chains.h.
chomp::homology::chainmap< euclidom >::chainmap | ( | const chaincomplex< euclidom > & | domain, | |
const chaincomplex< euclidom > & | range | |||
) | [inline] |
The default constructor of a chain map between the two given chain complexes.
Definition at line 3036 of file chains.h.
References chomp::homology::chainmap< euclidom >::add(), chomp::homology::chainmap< euclidom >::len, and chomp::homology::chainmap< euclidom >::map.
{ // set the dimension len = domain. len; if (range. len < domain. len) len = range. len; // allocate new matrices if (len) map = new mmatrix<euclidom> [len]; else map = NULL; for (int i = 0; i < len; ++ i) { // define the size of the matrix (number of rows and columns) map [i]. define (range. getnumgen (i), domain. getnumgen (i)); // link the matrices to the ones in the chain complexes domain. boundary [i]. dom_dom. add (map [i]); range. boundary [i]. dom_img. add (map [i]); if (i < domain. len - 1) domain. boundary [i + 1]. img_dom. add (map [i]); if (i < range. len - 1) range. boundary [i + 1]. img_img. add (map [i]); } return; } /* chainmap<euclidom>::chainmap */
chomp::homology::chainmap< euclidom >::chainmap | ( | const chainmap< euclidom > & | c | ) | [inline] |
Copy constructor.
Definition at line 3069 of file chains.h.
References chomp::homology::chainmap< euclidom >::len, and chomp::homology::chainmap< euclidom >::map.
chomp::homology::chainmap< euclidom >::~chainmap | ( | ) | [inline] |
The destructor.
Definition at line 3103 of file chains.h.
References chomp::homology::chainmap< euclidom >::map.
void chomp::homology::chainmap< euclidom >::add | ( | int | q, | |
int | m, | |||
int | n, | |||
euclidom | e | |||
) | [inline] |
Adds a coefficient to the selected matrix of the map: M_q [m, n] += e.
In other words, the image of n += e * m.
Definition at line 3125 of file chains.h.
References chomp::homology::chainmap< euclidom >::map.
Referenced by chomp::homology::chainmap< euclidom >::chainmap(), and chomp::homology::chainmap< euclidom >::take_homology().
void chomp::homology::chainmap< euclidom >::compose | ( | const chainmap< euclidom > & | m1, | |
const chainmap< euclidom > & | m2 | |||
) | [inline] |
Composes two given chain maps.
The chain map is replaced by the result of this composition.
Definition at line 3181 of file chains.h.
References chomp::homology::chainmap< euclidom >::len, and chomp::homology::chainmap< euclidom >::map.
int chomp::homology::chainmap< euclidom >::dim | ( | ) | const [inline] |
Returns the dimension of the chain map.
Definition at line 3111 of file chains.h.
References chomp::homology::chainmap< euclidom >::len.
{ return len - 1; } /* chainmap<euclidom>::dim */
void chomp::homology::chainmap< euclidom >::invert | ( | void | ) | [inline] |
Inverts the chain map.
Definition at line 3173 of file chains.h.
References chomp::homology::chainmap< euclidom >::len, and chomp::homology::chainmap< euclidom >::map.
chainmap< euclidom > & chomp::homology::chainmap< euclidom >::operator= | ( | const chainmap< euclidom > & | c | ) | [inline] |
const mmatrix< euclidom > & chomp::homology::chainmap< euclidom >::operator[] | ( | int | i | ) | const [inline] |
Returns the matrix of the chain map at the given level.
Definition at line 3117 of file chains.h.
References chomp::homology::chainmap< euclidom >::map.
{ // if ((i < 0) || (i >= len)) // throw "Chain map level out of range."; return map [i]; } /* chainmap<euclidom>::operator [] */
std::ostream & chomp::homology::chainmap< euclidom >::show | ( | std::ostream & | out, | |
const char * | maplabel = "f" , |
|||
const char * | xtxt = NULL , |
|||
const char * | ytxt = NULL , |
|||
const int * | level = NULL | |||
) | const [inline] |
Writes the chain map to an output stream in the text format using specified labels for the map and elements in the domain and in the codomain of the map.
Definition at line 3205 of file chains.h.
References chomp::homology::chainmap< euclidom >::show().
{ outputstream tout (out); show (tout, maplabel, xtxt, ytxt, level); return out; } /* chainmap<euclidom>::show */
outputstream & chomp::homology::chainmap< euclidom >::show | ( | outputstream & | out, | |
const char * | maplabel = "f" , |
|||
const char * | xtxt = NULL , |
|||
const char * | ytxt = NULL , |
|||
const int * | level = NULL | |||
) | const [inline] |
Writes the chain map to an output stream in the text format using specified labels for the map and elements in the domain and in the codomain of the map.
Definition at line 3190 of file chains.h.
References chomp::homology::chainmap< euclidom >::len, and chomp::homology::chainmap< euclidom >::map.
Referenced by chomp::homology::chainmap< euclidom >::show().
std::ostream & chomp::homology::chainmap< euclidom >::show_homology | ( | std::ostream & | out, | |
const chain< euclidom > * | hom_domain, | |||
const chain< euclidom > * | hom_range, | |||
const int * | level = NULL , |
|||
const char * | xtxt = NULL , |
|||
const char * | ytxt = NULL | |||
) | const [inline] |
Writes to an output stream the map induced in homology.
If the array of levels is provided, only these homology levels are displayed for which the array has a nonzero entry.
Definition at line 3249 of file chains.h.
References chomp::homology::chainmap< euclidom >::show_homology().
{ outputstream tout (out); show_homology (tout, hom_domain, hom_range, level, xtxt, ytxt); return out; } /* chainmap<euclidom>::show_homology */
outputstream & chomp::homology::chainmap< euclidom >::show_homology | ( | outputstream & | out, | |
const chain< euclidom > * | hom_domain, | |||
const chain< euclidom > * | hom_range, | |||
const int * | level = NULL , |
|||
const char * | xtxt = NULL , |
|||
const char * | ytxt = NULL | |||
) | const [inline] |
Writes to an output stream the map induced in homology.
If the array of levels is provided, only these homology levels are displayed for which the array has a nonzero entry.
Definition at line 3215 of file chains.h.
References chomp::homology::chainmap< euclidom >::len, and chomp::homology::chainmap< euclidom >::map.
Referenced by chomp::homology::chainmap< euclidom >::show_homology().
{ int max_len = len - 1; while ((max_len >= 0) && !hom_domain [max_len]. size ()) -- max_len; ++ max_len; for (int q = 0; q < max_len; ++ q) { if (!level || level [q]) { out << "Dim " << q << ":"; int hlen = hom_domain [q]. size (); if (!hlen) out << "\t0" << '\n'; for (int i = 0; i < hlen; ++ i) { out << "\tf ("; if (xtxt) out << xtxt; out << (i + 1) << ") = "; map [q]. show_hom_col (out, hom_domain [q]. num (i), hom_range [q], ytxt); out << '\n'; } } } return out; } /* chainmap<euclidom>::show_homology */
void chomp::homology::chainmap< euclidom >::take_homology | ( | const chainmap< euclidom > & | m, | |
const chain< euclidom > * | hom_domain, | |||
const chain< euclidom > * | hom_range | |||
) | [inline] |
Creates a chain map that represents the map induced in homology by the chain map between the two given chain complexes which have been previously transformed to the simple form.
Definition at line 3132 of file chains.h.
References chomp::homology::chainmap< euclidom >::add(), chomp::homology::chainmap< euclidom >::len, and chomp::homology::chainmap< euclidom >::map.
{ if (!hom_domain || !hom_range) return; for (int q = 0; q < len; ++ q) { int dlen = hom_domain [q]. size (); const chain<euclidom> &r = hom_range [q]; int rlen = r. size (); map [q]. define (rlen, dlen); // go through the homology generators in the domain for (int i = 0; i < dlen; ++ i) { // retrieve the real number of the homology generator int x = hom_domain [q]. num (i); // get the image of this element by the chain map const chain<euclidom> &img = m [q]. getcol (x); // transform numbers in this image to hom. generators int j = 0; for (int k = 0; k < img. size (); ++ k) { // find the current element in the range while ((j < rlen) && (r. num (j) < img. num (k))) ++ j; // if found in the range, add it if ((j < rlen) && (r. num (j) == img. num (k))) map [q]. add (j, i, img. coef (k)); } } } return; } /* chainmap<euclidom>::take_homology */
int chomp::homology::chainmap< euclidom >::len [private] |
The number of matrices (dimension of the chain map + 1).
Definition at line 3026 of file chains.h.
Referenced by chomp::homology::chainmap< euclidom >::chainmap(), chomp::homology::chainmap< euclidom >::compose(), chomp::homology::chainmap< euclidom >::dim(), chomp::homology::chainmap< euclidom >::invert(), chomp::homology::chainmap< euclidom >::show(), chomp::homology::chainmap< euclidom >::show_homology(), and chomp::homology::chainmap< euclidom >::take_homology().
mmatrix<euclidom>* chomp::homology::chainmap< euclidom >::map [private] |
The matrices in each dimension.
Definition at line 3029 of file chains.h.
Referenced by chomp::homology::chainmap< euclidom >::add(), chomp::homology::chainmap< euclidom >::chainmap(), chomp::homology::chainmap< euclidom >::compose(), chomp::homology::chainmap< euclidom >::invert(), chomp::homology::chainmap< euclidom >::operator[](), chomp::homology::chainmap< euclidom >::show(), chomp::homology::chainmap< euclidom >::show_homology(), chomp::homology::chainmap< euclidom >::take_homology(), and chomp::homology::chainmap< euclidom >::~chainmap().