44 #include "chomp/system/config.h" 45 #include "chomp/system/textfile.h" 46 #include "chomp/system/timeused.h" 47 #include "chomp/system/arg.h" 48 #include "chomp/struct/hashsets.h" 64 template <
class SimCellT,
class CoefT,
class CellArray1,
class CellArray2,
65 class CellArray3,
class CoefArray,
class CellNames>
67 const CellArray2 &A,
const CellArray3 &B,
const CoefArray &Q,
70 CellNames &cohomCellNames,
int ssquareVersion,
bool verify)
72 using chomp::homology::timeused;
73 using chomp::homology::sout;
74 using chomp::homology::sbug;
75 using chomp::homology::hashedset;
76 using chomp::homology::multitable;
79 sout <<
"Determining cohomology generators " 80 "from the algebraic topological model...\n";
81 std::vector<std::vector<SimCellT> > cohomRepresentants;
82 std::vector<int> cohomBettiNumbers;
83 std::vector<std::vector<CoefT> > cohomTorsion;
84 getHomCohom (H, A, B, Q, &cohomRepresentants, &cohomBettiNumbers,
88 sout <<
"Setting up names of the representants...\n";
89 int cohomReprSize = cohomRepresentants. size ();
90 for (
int dim = 0; dim < cohomReprSize; ++ dim)
92 int size = cohomRepresentants [dim]. size ();
93 for (
int i = 0; i < size; ++ i)
94 cohomCellNames (cohomRepresentants [dim] [i]);
99 #if CUBES_NOT_SIMPLICES && !DIRECT_CUBICAL_FORMULA 101 sout <<
"\nComputing the cup products...\n";
104 timeused cupCompTime;
109 hashedset<CellPair> cellPairs;
110 multitable<tChain<SimCellT,CoefT> > cupProducts;
113 cring (cohomRepresentants, pi, incl, cellPairs, cupProducts);
117 bool cupNonzeroFound =
false;
118 int_t cupSize = cellPairs. size ();
119 for (int_t n = 0; n < cupSize; ++ n)
121 if (cupProducts [n]. empty ())
123 if (!cupNonzeroFound)
125 sout <<
"The computed nonzero cup products are:\n";
126 cupNonzeroFound =
true;
128 sout << cohomCellNames (cellPairs [n]. left) <<
" u " <<
129 cohomCellNames (cellPairs [n]. right) <<
" = " <<
130 cells2names (cupProducts [n], cohomCellNames) <<
".\n";
132 if (!cupNonzeroFound)
133 sout <<
"All the computed cup products are trivial.\n";
136 sout <<
"The cup products were computed in " << cupCompTime <<
".\n";
141 sout <<
"\nComputing the Steenrod squares...\n";
149 hashedset<CellSquareT> cellsSquares;
150 multitable<tChain<SimCellT,CoefT> > squareValues;
154 switch (ssquareVersion)
158 cellsSquares, squareValues);
162 cellsSquares, squareValues);
165 throw "Invalid algorithm version " 166 "for Steenrod squares requested.";
170 bool nonzeroFound =
false;
171 int_t size = cellsSquares. size ();
172 for (int_t n = 0; n < size; ++ n)
174 if (squareValues [n]. empty ())
178 sout <<
"The nonzero Steenrod squares are:\n";
181 sout <<
"Sq^" << cellsSquares [n]. right <<
" (" <<
182 cohomCellNames (cellsSquares [n]. left) <<
") = " <<
187 sout <<
"All the computed Steenrod squares are trivial.\n";
190 sout <<
"The Steenrod squares were computed in " << compTime <<
197 #endif // _SSQCOMP_H_ 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 ssquares1(const std::vector< std::vector< CubCellT > > &cohomRepresentants, const tLinMap< CubCellT, CubCellT, CoefT > &pi, const tLinMap< CubCellT, CubCellT, CoefT > &incl, chomp::homology::hashedset< tPair< CubCellT, int > > &cellsSquares, chomp::homology::multitable< tChain< CubCellT, CoefT > > &squareValues)
Computes the Steenrod squares using the only procedure in this case.
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.
Hashing keys for std::string.
NamesT::NameType cells2names(const CellT &in, NamesT &names)
Returns the name of a cell according to the given naming object.
A chain with coefficients in an arbitrary commutative ring.
void computeSteenrodSquares(const CellArray1 &H, const CellArray2 &A, const CellArray3 &B, const CoefArray &Q, const tLinMap< SimCellT, SimCellT, CoefT > &pi, const tLinMap< SimCellT, SimCellT, CoefT > &incl, CellNames &cohomCellNames, int ssquareVersion, bool verify)
Computes the Steenrod squares, given an AT model of a cell complex.
void ssquares2(const std::vector< std::vector< CubCellT > > &cohomRepresentants, const tLinMap< CubCellT, CubCellT, CoefT > &pi, const tLinMap< CubCellT, CubCellT, CoefT > &incl, chomp::homology::hashedset< tPair< CubCellT, int > > &cellsSquares, chomp::homology::multitable< tChain< CubCellT, CoefT > > &squareValues)
Computes the Steenrod squares using the only procedure in this case.
Computation of the (co)homology groups of an algebraic minimal model.