34 #ifndef CUBES_NOT_SIMPLICES 35 #define CUBES_NOT_SIMPLICES 0 39 #if CUBES_NOT_SIMPLICES 40 #define SPACE_WRAPPING 44 #if CUBES_NOT_SIMPLICES 45 #ifndef DIRECT_CUBICAL_FORMULA 46 #define DIRECT_CUBICAL_FORMULA 1 60 #include "chomp/system/config.h" 61 #include "chomp/system/textfile.h" 62 #include "chomp/system/timeused.h" 63 #include "chomp/system/arg.h" 64 #include "chomp/struct/hashsets.h" 99 template <
class CellT,
class SimCellT,
class CoefT>
101 int algorithmVersion,
int ssquareVersion,
102 bool displayPi,
bool displayIncl,
bool displayPhi,
103 bool displayD,
bool displayRepr,
bool verify)
105 using chomp::homology::timeused;
106 using chomp::homology::sout;
107 using chomp::homology::sbug;
108 using chomp::homology::fileerror;
109 using chomp::homology::ignorecomments;
110 using chomp::homology::hashedset;
111 using chomp::homology::multitable;
117 #if CUBES_NOT_SIMPLICES 118 sout <<
"Working with CUBICAL cells. " 119 "(Please, re-compile for simplices.)\n";
120 #if DIRECT_CUBICAL_FORMULA 121 sout <<
"Using a direct formula for cubical cells. " 122 "(Recompile to change.)\n";
124 sout <<
"Using simplicial subdivision of cubical cells. " 125 "(Recompile to change.)\n";
128 sout <<
"Working with SIMPLICIAL cells. " 129 "(Please, re-compile for cubical sets.)\n";
133 sout <<
"Carrying out computations in the ring " <<
134 CoefT::ringsymbol () <<
".\n";
137 sout <<
"Reading the cells from '" << Xname <<
"'...\n";
138 hashedset<CellT> Xcells;
139 std::ifstream in (Xname);
144 if (Xcells. empty ())
145 throw "No cells read from the input file.";
146 sout << Xcells. size () <<
" cells read.\n";
151 sout <<
"WARNING: Relative complexes cannot yet be handled " 152 "by this program.\nThe contents of '" <<
153 Aname <<
"' will be ignored.\n";
156 #if CUBES_NOT_SIMPLICES && DIRECT_CUBICAL_FORMULA 157 hashedset<SimCellT> &Xsimpl (Xcells);
161 int_t size (Xsimpl. size ());
162 for (int_t i = 0; i < size; ++ i)
164 int dim = Xsimpl [i]. dim ();
172 sout <<
"Transforming the cubical set " 173 "into a filtered complex...\n";
178 #if CUBES_NOT_SIMPLICES 180 sout <<
"Transforming the cubical cells into products " 182 for (int_t i = 0; i < Xcells. size (); ++ i)
184 sout << Xsimpl. size () <<
" products created.\n";
186 sout <<
"Creating the structure of a simplicial set...\n";
187 for (int_t i = 0; i < Xcells. size (); ++ i)
188 Xsimpl. add (Xcells [i]);
191 sout <<
"Adding faces of cells in the product...\n";
192 int_t nAddedFaces = Xsimpl. addFaces ();
193 sout << nAddedFaces <<
" faces added, the complex has " <<
194 Xsimpl. size () <<
" elements.\n";
199 sout <<
"Normalizing the constructed simplicial set...\n";
200 int_t nDegenerate = Xsimpl. normalize ();
201 sout << nDegenerate <<
" degenerate cells removed, " <<
202 Xsimpl. size () <<
" cells remain.\n";
206 int dimension = Xsimpl. dim ();
209 sout <<
"Transforming the simplicial set " 210 "into a filtered complex...\n";
216 #if CUBES_NOT_SIMPLICES && DIRECT_CUBICAL_FORMULA 218 sout <<
"Adding boundaries of cells in the complex...\n";
220 sout <<
"The complex has " << K. size () <<
" cells.\n";
226 chomp::homology::hashedset<SimCellT> H, A, B;
227 std::vector<CoefT> Q;
230 sout <<
"Carrying out computations in the ring " <<
231 CoefT::ringsymbol () <<
".\n";
239 sout <<
"The computations up to now took " << compTime <<
".\n";
241 sout <<
"=== Computing an AT model ===\n";
246 H, pi, incl, phi, homCellNames,
247 displayPi, displayIncl, displayPhi,
248 displayRepr, verify, algorithmVersion);
251 sout <<
"The computations up to now took " << compTime <<
".\n";
255 ssquareVersion, verify);
271 typedef short int CoordT;
274 #if CUBES_NOT_SIMPLICES 277 #if DIRECT_CUBICAL_FORMULA 278 typedef CellT SimCellT;
287 using namespace chomp::homology;
290 program_time =
"Aborted after";
296 bool reduced =
false;
297 bool displayPi =
false;
298 bool displayIncl =
false;
299 bool displayPhi =
false;
300 bool displayD =
false;
301 bool displayRepr =
false;
303 int algorithmVersion = 2;
304 int ssquareVersion = 2;
305 #ifdef SPACE_WRAPPING 306 const int maxWrapping = 100;
307 char *wrapping [maxWrapping];
313 arg (a, NULL, Xname);
314 arg (a, NULL, Aname);
315 arg (a,
"a", algorithmVersion);
316 arg (a,
"s", ssquareVersion);
318 #ifdef SPACE_WRAPPING 319 arg (a,
"w", wrapping, nWrapping, maxWrapping);
321 argswitch (a,
"r", reduced,
true);
322 argswitch (a,
"dpi", displayPi,
true);
323 argswitch (a,
"dincl", displayIncl,
true);
324 argswitch (a,
"dphi", displayPhi,
true);
325 argswitch (a,
"dd", displayD,
true);
326 argswitch (a,
"drepr", displayRepr,
true);
327 argswitch (a,
"-verify", verify,
true);
330 argstreamprepare (a);
331 int argresult = a. analyze (argc, argv);
336 sout << title <<
'\n';
341 sout <<
"Call with '--help' for help.\n";
346 if ((argresult > 0) || !Xname || (p < 0))
348 sout << helpinfo <<
'\n';
361 CellT::EmptyType::setExistence (
true);
363 #ifdef SPACE_WRAPPING 365 for (
int i = 0; i < nWrapping; ++ i)
367 setWrapping<typename CellT::WrapType>
368 (std::string (wrapping [i]));
373 computeSteenrodSquares<CellT, SimCellT, CoefT> (Xname, Aname,
374 algorithmVersion, ssquareVersion,
375 displayPi, displayIncl, displayPhi,
376 displayD, displayRepr, verify);
378 program_time =
"Total time used:";
382 catch (
const char *msg)
384 sout <<
"ERROR: " << msg <<
'\n';
387 catch (
const std::exception &e)
389 sout <<
"ERROR: " << e. what () <<
'\n';
394 sout <<
"ABORT: An unknown error occurred.\n";
401 #endif // _SSQMAIN_H_ Elements of the ring Z_p.
Boundary computation at the level of chains of cells.
A function that creates a filter from a set of cells of different dimensions.
A cubical version of the Alexander-Whitney diagonal.
A function that converts a cubical cell into a simplicial set that corresponds to the cartesian produ...
A linear map for coefficients in an arbitrary commutative ring.
A simplex with vertices of arbitrary type.
const char * helpinfo
Brief help information on the program's usage.
The Shih operator as a component of the Eilenberg-Zilber chain contraction.
void cube2product(const CubCellT &q, SetT &cells)
Transforms an elementary cube into a simplicial set that represents the Cartesian product of the simp...
A class whose instances can be used to generate names of cells with subsequent numbers, in each dimension separately.
A combinatorial linear map (for coefficients in Z_2).
Tools for coordinate wrapping, a.k.a.
void set2filter(const SetT &set, FilterT &filter, int maxDim)
Transforms a collection of cells to a filter by adding them in the order of decreasing dimension...
void addBoundaries(tFilteredComplex< CellT > &K, const CellRestrT &restr)
Adds boundaries to all the cells in the given filtered complex.
A class for naming cells for nice text data output.
Hashing keys for std::string.
A chain with coefficients in an arbitrary commutative ring.
A generic procedure for the computation of the Steenrod squares for an algebraic topological model...
A simplex class with arbitrary vertices.
The Alexander-Whitney operator as a component of the Eilenberg-Zilber chain contraction.
const char * title
The title of the program and licensing information.
The decision on whether the empty cell should be used as a valid cell of dimension -1...
A generic procedure for reading a filtered cell complex or a pair of filtered cell complexes from tex...
Alexander-Whitney diagonal of a chain.
A Cartesian product of simplicial cells as a simplicial cell.
An empty cell existence decision class with settable global flag.
An element of the ring Z_p, where p is globally set.
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 simplicial version of the Alexander-Whitney diagonal.
A template of a simple class for unrestricted cell selection in the boundary computation procedures...
The Eilenberg-Mac Lane operator as a component of the Eilenberg-Zilber chain contraction.
int steenrodSquaresMain(int argc, char *argv [], const char *title, const char *helpinfo)
The main procedure of the program.
An elementary cubical cell with vertex coordinates of integer type.
void computeSteenrodSquares(const char *Xname, const char *Aname, int algorithmVersion, int ssquareVersion, bool displayPi, bool displayIncl, bool displayPhi, bool displayD, bool displayRepr, bool verify)
Runs the experimental calculations.
A generic procedure for the computation of chain contraction of a filtered cell complex stored in a f...