42 #include "chomp/system/config.h" 43 #include "chomp/system/textfile.h" 44 #include "chomp/system/timeused.h" 45 #include "chomp/struct/hashsets.h" 64 template <
class CellT,
class LinMap,
class CellNames>
67 chomp::homology::hashedset<CellT> &H,
68 LinMap &pi, LinMap &incl, LinMap &phi,
70 bool displayPi,
bool displayIncl,
bool displayPhi,
71 bool displayRepr,
bool verify,
int algorithmVersion)
73 using chomp::homology::sout;
76 typedef typename LinMap::CoefType CoefT;
81 algTopModel (K, H, pi, incl, phi, algorithmVersion, K);
90 chomp::homology::hashedset<CellT> emptyCellArray;
91 chomp::homology::hashedset<CoefT> emptyCoefArray;
92 std::vector<std::vector<CellT> > representants;
93 std::vector<int> bettiNumbers;
94 std::vector<std::vector<CoefT> > torsion;
95 getHomCohom (H, emptyCellArray, emptyCellArray, emptyCoefArray,
96 &representants, &bettiNumbers, &torsion,
false);
97 sout <<
"Homology groups:\n";
102 sout <<
"Representants of homology generators:\n";
103 int reprSize = representants. size ();
104 for (
int dim = 0; dim < reprSize; ++ dim)
106 int size = representants [dim]. size ();
107 for (
int i = 0; i < size; ++ i)
109 const CellT &cell (representants [dim] [i]);
112 sout << cellNames (cell) <<
": " <<
126 sout <<
"The projection map pi:\n" <<
131 sout <<
"The inclusion map incl:\n" <<
136 sout <<
"The homology gradient vector field phi:\n" << phi;
149 if (phi * boundaryMap * phi == phi)
150 sout <<
"Verified: 'phi bd phi = phi'.\n";
152 sout <<
"Failed to verify that " 153 "'phi pd phi = phi'.\n";
155 if (boundaryMap * phi * boundaryMap == boundaryMap)
156 sout <<
"Verified: 'bd phi bd = bd'.\n";
158 sout <<
"Failed to verify that 'bd phi bd = bd'.\n";
161 if (phi * phi == zeroMap)
162 sout <<
"Verified: 'phi phi = 0'.\n";
164 sout <<
"Failed to verify that 'phi phi = 0'.\n";
166 LinMap composition (boundaryMap * phi);
167 composition += phi * boundaryMap;
168 composition. negate ();
170 if (incl * pi == composition)
171 sout <<
"Verified: 'i pi = id - bd phi - phi bd'.\n";
173 sout <<
"Failed to verify that " 174 "'i pi = id - bd phi - phi bd'.\n";
178 if (pi * incl == idH)
179 sout <<
"Verified: 'pi i = id_H'.\n";
181 sout <<
"Failed to verify that 'pi i = id_H'.\n";
183 if (pi * phi == zeroMap)
184 sout <<
"Verified: 'pi phi = 0'.\n";
186 sout <<
"Failed to verify that 'pi phi = 0'.\n";
188 if (phi * incl == zeroMap)
189 sout <<
"Verified: 'phi i = 0'.\n";
191 sout <<
"Failed to verify that 'phi i = 0'.\n";
198 #endif // _ATMODCOMP_H_ Boundary computation at the level of chains of cells.
void algTopModel(const CellArray1 &K, CellArray2 &H, tCombLinMap< CellT, CellT > &pi, tCombLinMap< CellT, CellT > &incl, tCombLinMap< CellT, CellT > &phi, int version, const CellRestrT &restr)
Computes a combinatorial algebraic topological model for a given filtered finite cell complex "K"...
std::string homcohom2text(int bettiNumber, const std::vector< CoefT > &torsion, bool torsion_subscript)
Returns a text description of one (co)homology group.
Algebraic topological model computation: An interface to all the algorithms available in this package...
void computeBoundaryMap(const CellArray &cells, tCombLinMap< CellT, CellT > &f, const CellRestrT &restr)
Computes the full boundary map for a cellular complex that contains the cells in a provided set and a...
A class for providing the cells as their names.
void getHomCohom(const CellArray1 &H, const CellArray2 &A, const CellArray3 &B, const CoefArray &Q, std::vector< std::vector< CellT > > *representants, std::vector< int > *bettiNumbers, std::vector< std::vector< CoefT > > *torsion, bool cohomology)
Computes Betti numbers and torsion coefficients for (co)homology from an algebraic minimal model (set...
A class for naming cells for nice text data output.
NamesT::NameType cells2names(const CellT &in, NamesT &names)
Returns the name of a cell according to the given naming object.
A generic procedure for reading a filtered cell complex or a pair of filtered cell complexes from tex...
void addIdentity(const CellArray &domain, tCombLinMap< CellT, CellT > &f)
Adds the identity map on the given domain to the map 'f'.
void computeAlgTopModel(const tFilteredComplex< CellT > &K, bool relativeComplex, chomp::homology::hashedset< CellT > &H, LinMap &pi, LinMap &incl, LinMap &phi, CellNames &cellNames, bool displayPi, bool displayIncl, bool displayPhi, bool displayRepr, bool verify, int algorithmVersion)
Computes an AT model and the homology of a cellular complex.
A template of a simple class for unrestricted cell selection in the boundary computation procedures...
Computation of the (co)homology groups of an algebraic minimal model.