42 #include "chomp/system/config.h" 43 #include "chomp/system/textfile.h" 44 #include "chomp/system/timeused.h" 45 #include "chomp/struct/hashsets.h" 46 #include "chomp/struct/multitab.h" 61 template <
class CellT,
class CoefT,
class CellArray1,
class CellArray2,
62 class CellArray3,
class CoefArray,
class CellNames>
64 const CellArray3 &B,
const CoefArray &Q,
67 CellNames &cellNames,
bool verify)
69 using chomp::homology::sout;
70 using chomp::homology::sbug;
71 using chomp::homology::timeused;
72 using chomp::homology::hashedset;
73 using chomp::homology::multitable;
85 std::vector<std::vector<CellT> > cohomRepresentants;
86 std::vector<int> cohomBettiNumbers;
87 std::vector<std::vector<CoefT> > cohomTorsion;
88 getHomCohom (H, A, B, Q, &cohomRepresentants, &cohomBettiNumbers,
93 int cohomReprSize = cohomRepresentants. size ();
94 for (
int dim = 0; dim < cohomReprSize; ++ dim)
96 int size = cohomRepresentants [dim]. size ();
97 for (
int i = 0; i < size; ++ i)
98 cellNames (cohomRepresentants [dim] [i]);
103 hashedset<CellPair> cellPairs;
104 multitable<tChain<CellT,CoefT> > cupProducts;
107 cring (cohomRepresentants, pi, incl, cellPairs, cupProducts);
111 bool nonzeroFound =
false;
112 int_t size = cellPairs. size ();
113 for (int_t n = 0; n < size; ++ n)
115 if (cupProducts [n]. empty ())
119 sout <<
"The computed nonzero cup products are:\n";
122 sout << cellNames (cellPairs [n]. left) <<
" u " <<
123 cellNames (cellPairs [n]. right) <<
" = " <<
127 sout <<
"All the computed cup products are trivial.\n";
130 sout <<
"The ring structure was computed in " << compTime <<
".\n";
136 #endif // _CRINGCOMP_H_ void computeCohomRing(const CellArray1 &H, const CellArray2 &A, const CellArray3 &B, const CoefArray &Q, const tLinMap< CellT, CellT, CoefT > &pi, const tLinMap< CellT, CellT, CoefT > &incl, CellNames &cellNames, bool verify)
Computes the cohomology ring, given a minimal model of a cell complex, and shows the result...
A pair of elements of two (possibly different) types.
void cring(const std::vector< std::vector< CellT > > &cohomRepresentants, const tLinMap< CellT, CellT, CoefT > &pi, const tLinMap< CellT, CellT, CoefT > &incl, chomp::homology::hashedset< tPair< CellT, CellT > > &cellPairs, chomp::homology::multitable< tChain< CellT, CoefT > > &cupProducts)
Computes the cohomology ring, given a minimal model and cohomology representants. ...
A linear map for coefficients in an arbitrary commutative ring.
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...
Computation of the cohomology ring.
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.