31 #ifdef CUBES_NOT_SIMPLICES 32 #define SPACE_WRAPPING 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" 77 Experimentation with the formulas for the E-Z chain contraction.\n\ 78 Version 0.00 (Dec 4, 2014). Copyright (C) 1997-2016 by Pawel Pilarczyk.\n\ 79 This is free software. No warranty. Consult 'license.txt' for details.";
83 This program does some computations to experiment with the Eilenberg-Zilber\n\ 85 The ring of coefficients is Z or Z_p (the integers modulo prime number p).\n\ 87 filename - the name of a file that contains a list of cells for the test,\n\ 88 Switches and additional arguments:\n\ 89 -pN - selection of the coefficients: p=0 for Z, p=1 unsupported in this\n\ 90 \tprogram, p > 1 for Z_p (default: p=2); please, use p <= 181,\n\ 91 -r - compute reduced homology (with the empty set as a cell of dim -1),\n\ 92 --log filename - save the output to a file (without progress indicators),\n\ 93 --quiet - suppress data output to the screen (whcih can be still logged),\n\ 94 --help - display this brief help information only and exit.\n\ 95 For more information please consult the accompanying documentation\n\ 96 or ask the program's author at http://www.PawelPilarczyk.com/.";
104 template <
class CellT,
class CoefT>
107 using chomp::homology::sout;
108 using chomp::homology::ignorecomments;
114 sout <<
"Checking the experimental formulas...\n";
117 std::ifstream in (Xname);
119 throw "Can't open the input file.";
138 ProdT product (x, y);
142 tensor. add (x, y, CoefT (1));
143 TensorProdT tensorProd;
144 tensorProd. add (ProdT (x), ProdT (y), CoefT (1));
147 TensorCellT resultAW;
148 EZ_AW (x, y, resultAW);
149 sout <<
"AW (" << x <<
" X " << y <<
") = " <<
153 sout <<
"EML (" << x <<
" x " << y <<
") = " <<
157 sout <<
"SHI (" << x <<
" X " << y <<
") = " <<
162 EZ_EML (tensor, result1a);
164 EZ_SHI (result1a, result1b);
165 if (result1b. empty ())
167 sout <<
"Verified: SHI EML (" << x <<
" x " << y <<
172 sout <<
"PROBLEM: SHI EML (" << x <<
" x " << y <<
173 ") is nonzero: " << result1b <<
".\n";
178 EZ_SHI (product, result2a);
180 EZ_SHI (result2a, result2b);
181 if (result2b. empty ())
183 sout <<
"Verified: SHI SHI (" << x <<
" X " << y <<
188 sout <<
"PROBLEM: SHI SHI (" << x <<
" X " << y <<
189 ") is nonzero: " << result2b <<
".\n";
194 EZ_SHI (product, result3a);
195 TensorProdT result3b;
196 EZ_AW (result3a, result3b);
197 if (result3b. empty ())
199 sout <<
"Verified: AW SHI (" << x <<
" X " << y <<
204 sout <<
"PROBLEM: AW SHI (" << x <<
" X " << y <<
205 ") is nonzero: " << result3b <<
".\n";
210 EZ_EML (tensor, result4a);
211 TensorProdT result4b;
212 EZ_AW (result4a, result4b);
213 if (result4b == tensorProd)
215 sout <<
"Verified: AW EML (" << x <<
" x " << y <<
216 ") = " << x <<
" x " << y <<
".\n";
220 sout <<
"PROBLEM: AW EML (" << x <<
" x " << y <<
221 ") differs from " << x <<
" x " << y <<
222 ": " << result4b <<
".\n";
227 EZ_SHI (product, result5a);
231 result5b. add (product, CoefT (1));
232 sout <<
"(I - d SHI) (" << x <<
" X " << y <<
") = " <<
237 prodChain. add (product, CoefT (1));
241 EZ_SHI (result6a, result6b);
243 result6b += prodChain;
244 sout <<
"(I - SHI d) (" << x <<
" X " << y <<
") = " <<
251 sout << counter <<
" pair" << ((counter == 1) ?
"" :
"s") <<
252 " of cells have been tested.\n";
263 int main (
int argc,
char *argv [])
265 #ifdef CUBES_NOT_SIMPLICES 274 using namespace chomp::homology;
277 program_time =
"Aborted after";
282 bool reduced =
false;
283 #ifdef SPACE_WRAPPING 284 const int maxWrapping = 100;
285 char *wrapping [maxWrapping];
291 arg (a, NULL, Xname);
293 #ifdef SPACE_WRAPPING 294 arg (a,
"w", wrapping, nWrapping, maxWrapping);
296 argswitch (a,
"r", reduced,
true);
299 argstreamprepare (a);
300 int argresult = a. analyze (argc, argv);
305 sout <<
title <<
'\n';
310 sout <<
"Call with '--help' for help.\n";
315 if ((argresult > 0) || !Xname || (p < 0))
327 sout <<
"Carrying out computations in the ring " <<
328 CoefT::ringsymbol () <<
".\n";
332 CellT::EmptyType::setExistence (
true);
334 #ifdef SPACE_WRAPPING 336 for (
int i = 0; i < nWrapping; ++ i)
338 setWrapping<typename CellT::WrapType>
339 (std::string (wrapping [i]));
344 experiment<CellT,CoefT> (Xname);
346 program_time =
"Total time used:";
350 catch (
const char *msg)
352 sout <<
"ERROR: " << msg <<
'\n';
355 catch (
const std::exception &e)
357 sout <<
"ERROR: " << e. what () <<
'\n';
362 sout <<
"ABORT: An unknown error occurred.\n";
Elements of the ring Z_p.
Boundary computation at the level of chains of cells.
A cubical version of the Alexander-Whitney diagonal.
int main(int argc, char *argv [])
The main procedure of the program.
A linear map for coefficients in an arbitrary commutative ring.
A simplex with vertices of arbitrary type.
void experiment(const char *Xname)
Runs the experimental calculations.
The Shih operator as a component of the Eilenberg-Zilber chain contraction.
A chain with coefficients in an arbitrary ring.
A combinatorial linear map (for coefficients in Z_2).
Tools for coordinate wrapping, a.k.a.
void EZ_SHI(const SimCellT &s1, const SimCellT &s2, tCombChain< ProdCellT > &t)
Computes the Shih operator on a product of two simplicial cells.
void computeBoundary(const CellT &c, tCombChain< CellT > &b, const CellRestrT &restr)
Adds the boundary of a given cell to the provided chain (takes boundary cells restricted by the given...
void EZ_EML(const SimCellT &s1, const SimCellT &s2, tCombChain< ProdCellT > &t)
Computes the Eilenberg-Mac Lane operator on a tensor product of two simplicial cells.
A class for naming cells for nice text data output.
void EZ_AW(const SimCellT &s1, const SimCellT &s2, tCombTensor< SimCellT, SimCellT > &t)
Computes the Alexander-Whitney operator on a product of simplicial cells.
Hashing keys for std::string.
A chain with coefficients in an arbitrary commutative ring.
A simplex class with arbitrary vertices.
The Alexander-Whitney operator as a component of the Eilenberg-Zilber chain contraction.
const char * helpinfo
Brief help information on the program's usage.
The decision on whether the empty cell should be used as a valid cell of dimension -1...
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.
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.
An elementary cubical cell with vertex coordinates of integer type.
const char * title
The title of the program and licensing information.