This file contains various procedures for the homology computation. More...
#include "chomp/system/config.h"
#include "chomp/system/textfile.h"
#include "chomp/system/timeused.h"
#include "chomp/system/arg.h"
#include "chomp/struct/words.h"
#include "chomp/struct/localvar.h"
#include "chomp/homology/homtools.h"
#include "chomp/cubes/bincube.h"
#include "chomp/cubes/twolayer.h"
Go to the source code of this file.
Namespaces | |
namespace | chomp |
This namespace contains the entire CHomP library interface. | |
namespace | chomp::homology |
This namespace contains the core of the homology computation procedures and related classes and templates contained in the CHomP C++ library. | |
Typedefs | |
typedef chaincomplex< integer > | chomp::homology::ChainComplex |
A class for representing a chain complex with integral coefficients. | |
typedef chainmap< integer > | chomp::homology::ChainMap |
A class for representing a chain map with integral coefficients. | |
typedef chain< integer > | chomp::homology::Chain |
A class for representing a chain with integral coefficients. | |
typedef hashedset< simplex > | chomp::homology::SetOfSimplices |
A class for representing a set of simplices. | |
typedef gcomplex< simplex, integer > | chomp::homology::SimplicialComplex |
A class for representing a simplicial complex. | |
Functions | |
template<class euclidom > | |
int | chomp::homology::BettiNumber (const chain< euclidom > &c) |
Returns the Betti number that corresponds to the given chain which describes one homology group. | |
template<class euclidom > | |
int | chomp::homology::TorsionCoefficient (const chain< euclidom > &c, int start=0) |
Returns the next position in the chain containing a torsion coefficient. | |
template<class euclidom > | |
void | chomp::homology::ShowHomology (const chain< euclidom > &c) |
Shows (that is, writes to 'sout') one level of the homology module encoded in the given chain. | |
template<class euclidom > | |
void | chomp::homology::ShowHomology (const chain< euclidom > *hom, int maxlevel) |
Shows (that is, writes to 'sout') the entire homology module encoded in an array of chains. | |
template<class euclidom > | |
void | chomp::homology::ShowHomology (const chainmap< euclidom > &hmap) |
Show (that is, writes to 'sout') the homology map encoded in terms of a chain map. | |
template<class euclidom > | |
void | chomp::homology::ShowGenerator (const chain< euclidom > &c) |
Shows (that is, writes to 'sout') one generator of the homology module of a chain complex. | |
template<class euclidom > | |
void | chomp::homology::ShowGenerators (const chain< euclidom > *c, int count) |
Shows (that is, writes to 'sout') all the generators of one level of the homology module of a chain complex. | |
template<class euclidom > | |
void | chomp::homology::ShowGenerators (chain< euclidom > const *const *const gen, const chain< euclidom > *hom, int maxlevel) |
Shows (that is, writes to 'sout') all the generators of the entire homology module of a chain complex. | |
template<class euclidom > | |
void | chomp::homology::ShowGenerators (const chaincomplex< euclidom > &c, const chain< euclidom > *hom, int maxlevel) |
Shows (that is, writes to 'sout') all the generators of the entire homology module of a chain complex. | |
template<class cell , class euclidom > | |
void | chomp::homology::ShowGenerator (const chain< euclidom > &c, const hashedset< cell > &s) |
Shows (that is, writes to 'sout') one generator of the homology module of a geometric complex. | |
template<class cell , class euclidom > | |
void | chomp::homology::ShowGenerators (const chain< euclidom > *c, int count, const hashedset< cell > &s) |
Shows (that is, writes to 'sout') all the generators of one level of the homology module of a geometric complex. | |
template<class euclidom , class cell > | |
void | chomp::homology::ShowGenerators (chain< euclidom > *const *gen, const chain< euclidom > *hom, int maxlevel, const gcomplex< cell, euclidom > &gcompl) |
Shows all the generators of the entire homology module of a geometric complex. | |
template<class euclidom > | |
chain< euclidom > ** | chomp::homology::ExtractGenerators (const chaincomplex< euclidom > &cx, chain< euclidom > *hom, int maxlevel) |
Extracts homology generators from a chain complex in the simple form. | |
template<class euclidom > | |
int | chomp::homology::Homology (chaincomplex< euclidom > &cx, const char *Xname, chain< euclidom > *&hom) |
Transforms the chain complex into a simple form and compute its homology. | |
template<class cell , class euclidom > | |
int | chomp::homology::Homology (gcomplex< cell, euclidom > &Xcompl, const char *Xname, chain< euclidom > *&hom, chain< euclidom > ***gen=0) |
Computes the homology of a given cubical complex. | |
template<class euclidom , class cubetype > | |
int | chomp::homology::Homology (hashedset< cubetype > &Xcubes, const char *Xname, chain< euclidom > *&hom, chain< euclidom > ***gen=0, gcomplex< typename cubetype::CellType, euclidom > **gcompl=0) |
Computes the homology of a given set of cubes. | |
template<class cell , class euclidom > | |
int | chomp::homology::Homology (gcomplex< cell, euclidom > &Xcompl, const char *Xname, gcomplex< cell, euclidom > &Acompl, const char *Aname, chain< euclidom > *&hom, chain< euclidom > ***gen=0) |
Computes the relative homology of the given pair of cubical complexes. | |
template<class euclidom , class cubetype > | |
int | chomp::homology::Homology (hashedset< cubetype > &Xcubes, const char *Xname, hashedset< cubetype > &Acubes, const char *Aname, chain< euclidom > *&hom, chain< euclidom > ***gen=0, gcomplex< typename cubetype::CellType, euclidom > **gcompl=0) |
Computes the relative homology of a given pair of sets of cubes. | |
template<class euclidom > | |
chainmap< euclidom > * | chomp::homology::HomologyMap (const chainmap< euclidom > &cmap, const chain< euclidom > *hom_cx, const chain< euclidom > *hom_cy, int maxlevel) |
Extracts the homomorphism induced in homology from the chain map on two chain complexes whose homology has just been computed. | |
template<class euclidom > | |
chainmap< euclidom > * | chomp::homology::HomologyMap (const chainmap< euclidom > &cmap, const chain< euclidom > *hom_cx, int maxlevel) |
Extracts the endomorphism induced in homology from the chain map on one chain complex whose homology has just been computed. | |
template<class euclidom , class cubetype > | |
int | chomp::homology::Homology (mvmap< cubetype, cubetype > &Fcubmap, const char *Fname, hashedset< cubetype > &Xcubes, const char *Xname, hashedset< cubetype > &Acubes, const char *Aname, hashedset< cubetype > &Ycubes, const char *Yname, hashedset< cubetype > &Bcubes, const char *Bname, chain< euclidom > *&hom_cx, int &maxlevel_cx, chain< euclidom > *&hom_cy, int &maxlevel_cy, chainmap< euclidom > *&hom_f, bool inclusion=false, int careful=0x01, chain< euclidom > ***gfgen=0, gcomplex< typename cubetype::CellType, euclidom > **gfcompl=0, chain< euclidom > ***gygen=0, gcomplex< typename cubetype::CellType, euclidom > **gycompl=0) |
Computes the homomorphism induced in homology by a combinatorial cubical multivalued map. | |
template<class euclidom , class cubetype > | |
int | chomp::homology::Homology (mvmap< cubetype, cubetype > &Fcubmap, hashedset< cubetype > &Xcubes, hashedset< cubetype > &Acubes, hashedset< cubetype > &Ycubes, hashedset< cubetype > &Bcubes, chain< euclidom > *&hom_cx, int &maxlevel_cx, chain< euclidom > *&hom_cy, int &maxlevel_cy, chainmap< euclidom > *&hom_f, bool inclusion=false, int careful=0x01, chain< euclidom > ***gfgen=0, gcomplex< typename cubetype::CellType, euclidom > **gfcompl=0, chain< euclidom > ***gygen=0, gcomplex< typename cubetype::CellType, euclidom > **gycompl=0) |
A version of the above procedure with the default names. | |
template<class euclidom , class cubetype > | |
int | chomp::homology::Homology (mvmap< cubetype, cubetype > &Fcubmap, const char *Fname, hashedset< cubetype > &Xcubes, const char *Xname, hashedset< cubetype > &Acubes, const char *Aname, chain< euclidom > *&hom, int &maxlevel, chainmap< euclidom > *&hom_f, int careful=0x01, chain< euclidom > ***gfgen=0, gcomplex< typename cubetype::CellType, euclidom > **gfcompl=0, chain< euclidom > ***gygen=0, gcomplex< typename cubetype::CellType, euclidom > **gycompl=0) |
Computes the endomorphism induced in homology by a combinatorial cubical multivalued map. | |
template<class euclidom , class cubetype > | |
int | chomp::homology::Homology (mvmap< cubetype, cubetype > &Fcubmap, hashedset< cubetype > &Xcubes, hashedset< cubetype > &Acubes, chain< euclidom > *&hom, int &maxlevel, chainmap< euclidom > *&hom_f, int careful=0x01, chain< euclidom > ***gfgen=0, gcomplex< typename cubetype::CellType, euclidom > **gfcompl=0, chain< euclidom > ***gygen=0, gcomplex< typename cubetype::CellType, euclidom > **gycompl=0) |
A version of the above procedure with the default names. | |
template<class euclidom , class cubetype > | |
int | chomp::homology::Homology2l (mvmap< cubetype, cubetype > &Fcubmap0, const char *Fname, hashedset< cubetype > &Xcubes0, const char *Xname, hashedset< cubetype > &Acubes0, const char *Aname, chain< euclidom > *&hom_cx, int &maxlevel, chainmap< euclidom > *&hom_f, int careful=0x01, chain< euclidom > ***gfgen=0, gcomplex< tCell2l< typename cubetype::CellType >, euclidom > **gfcompl=0, chain< euclidom > ***gygen=0, gcomplex< tCell2l< typename cubetype::CellType >, euclidom > **gycompl=0) |
Computes the endomorphism induced in homology by a combinatorial cubical multivalued map using the two-layer construction developped by P. | |
template<class euclidom , class cubetype > | |
int | chomp::homology::Homology2l (mvmap< cubetype, cubetype > &Fcubmap, hashedset< cubetype > &Xcubes, hashedset< cubetype > &Acubes, chain< euclidom > *&hom, int &maxlevel, chainmap< euclidom > *&hom_f, int careful=0x01, chain< euclidom > ***gfgen=0, gcomplex< tCell2l< typename cubetype::CellType >, euclidom > **gfcompl=0, chain< euclidom > ***gygen=0, gcomplex< tCell2l< typename cubetype::CellType >, euclidom > **gycompl=0) |
A version of the above procedure with the default names. | |
bool | chomp::homology::acyclic (const cube &q, const cubes &X) |
Verifies whether the neighborhood of q in X is acyclic. | |
template<int dim, int twoPower> | |
void | chomp::homology::ComputeBettiNumbers (bincube< dim, twoPower > &b, int *result) |
Computes the Betti Numbers of a set of full cubes in a bincube. | |
template<int dim, int twoPower, class coordtype > | |
void | chomp::homology::ComputeBettiNumbers (char *binary_buffer, int *result, const coordtype *space_wrapping=0) |
Computes the Betti Numbers of the Homology of a full cubical set defined by means of an n-dimensional bitmap. | |
template<class coordtype > | |
void | chomp::homology::ComputeBettiNumbers (coordtype *coord, int n, int dim, int *result) |
Computes the Betti numbers of the given set of full cubes. | |
template<class coordtype > | |
void | chomp::homology::SetSpaceWrapping (int dim, const coordtype *wrap) |
Sets space wrapping in each direction separately. |
This file contains various procedures for the homology computation.
This is - to certain extent - a "high-level" interface to the homology library. These functions can be run to compute the homology of cubical sets and maps, and the Betti numbers or torsion coefficients can be extracted from the result in a convenient way.
It is worth to know that in this interface, the homology module is encoded as an array of chains. Each chain contains the information on homology for one level, beginning with 0. Each entry of the chain contains either a unit (an invertible coefficient, whose "delta" function equals 1) or the corresponding torsion coefficient. By counting the number of invertible coefficients one can determine the corresponding Betti number. The functions "BettiNumber" and "TorsionCoefficient" can be used to extract these quantities in a convenient way, without processing the chains themselves.
During the computations, various messages are written to the stream "sout" and computation progress indicators are directed to "scon". Use "sout. show = false" and "scon. show = false" to suppress these messages. Please, consult the details of the class "outputstream" in "chomp/system/textfile.h" for more options, including logging these messages to files.
In case of a fatal error, all the procedures throw a text (of the type "char *" or "const char *") with the error message.
Definition in file homology.h.