33 #include "chomp/system/config.h" 34 #include "chomp/system/textfile.h" 35 #include "chomp/system/timeused.h" 36 #include "chomp/system/arg.h" 37 #include "chomp/struct/hashsets.h" 65 * * * UNDER CONSTRUCTION * * *\n\ 66 Certain experimental computations of cubical sets by means of their\n\ 67 simplicial subdivision.\n\ 68 Version 0.00 (June 10, 2015). Copyright (C) 1997-2016 by Pawel Pilarczyk.\n\ 69 This is free software. No warranty. Consult 'license.txt' for details.";
73 This program does some experimental computations on cubical sets\n\ 74 using their representation by means of the Cartesian product\n\ 75 of the simplicial sets that correspond to the faces of the cubes.\n\ 76 The ring of coefficients for cohomology computation can be either set to Z\n\ 77 or to Z_p (the integers modulo prime number p).\n\ 79 filename - the name of a file that contains a list of cubical cells,\n\ 80 Switches and additional arguments:\n\ 81 -pN - selection of the coefficients: p=0 for Z, p>1 for Z_p (default: 0);\n\ 82 \tnote: one should use p <= 181,\n\ 83 -dpi, -dincl, -dphi - display the computed maps: pi, incl, phi,\n\ 84 -dd - display the boundary map in the minimal model (the nontrivial part),\n\ 85 --verify - do additional verification of the computed maps,\n\ 86 --log filename - save the output to a file (without progress indicators),\n\ 87 --quiet - suppress data output to the screen (whcih can be still logged),\n\ 88 --help - display this brief help information only and exit.\n\ 89 For more information please consult the accompanying documentation\n\ 90 or ask the program's author at http://www.PawelPilarczyk.com/.";
99 int main (
int argc,
char *argv [])
101 using namespace chomp::homology;
104 typedef short int CoordT;
110 program_time =
"Aborted after";
116 bool reduced =
false;
117 bool displayPi =
false;
118 bool displayIncl =
false;
119 bool displayPhi =
false;
120 bool displayD =
false;
122 #ifdef SPACE_WRAPPING 123 const int maxWrapping = 100;
124 char *wrapping [maxWrapping];
130 arg (a, NULL, Xname);
131 arg (a, NULL, Aname);
133 #ifdef SPACE_WRAPPING 134 arg (a,
"w", wrapping, nWrapping, maxWrapping);
136 argswitch (a,
"r", reduced,
true);
137 argswitch (a,
"dpi", displayPi,
true);
138 argswitch (a,
"dincl", displayIncl,
true);
139 argswitch (a,
"dphi", displayPhi,
true);
140 argswitch (a,
"dd", displayD,
true);
141 argswitch (a,
"-verify", verify,
true);
144 argstreamprepare (a);
145 int argresult = a. analyze (argc, argv);
150 sout <<
title <<
'\n';
155 sout <<
"Call with '--help' for help.\n";
160 if ((argresult > 0) || !Xname || (p < 0))
170 throw "Relative chains not supported yet.";
175 throw "Reduced homology not supported yet.";
179 #ifdef SPACE_WRAPPING 181 throw "Space wrapping not supported yet.";
184 for (
int i = 0; i < nWrapping; ++ i)
186 setWrapping<typename CubCellT::WrapType>
187 (std::string (wrapping [i]));
197 sout <<
"Reading cubical cells from '" << Xname <<
"'...\n";
198 hashedset<CubCellT> Xcubes;
199 std::ifstream in (Xname);
204 if (Xcubes. empty ())
205 throw "No cubical cells read from the input file.";
206 sout << Xcubes. size () <<
" cubical cells read.\n";
209 sout <<
"Transforming the cubical cells into products " 212 for (int_t i = 0; i < Xcubes. size (); ++ i)
214 sout << Xsimpl. size () <<
" products created.\n";
223 sout <<
"Normalizing the constructed simplicial set...\n";
224 int_t nDegenerate = Xsimpl. normalize ();
225 sout << nDegenerate <<
" degenerate cells removed.\n";
229 sout <<
"Transforming the simplicial set " 230 "into a filtered complex...\n";
236 chomp::homology::hashedset<CellT> H, A, B;
237 std::vector<CoefT> Q;
240 sout <<
"Carrying out computations in the ring " <<
241 CoefT::ringsymbol () <<
".\n";
247 sout <<
"=== Computing the minimal model ===\n";
249 dummyCellNames, cellNames,
250 displayPi, displayIncl, displayPhi, displayD,
253 sout <<
"=== Computing the cohomology ring ===\n";
256 program_time =
"Total time used:";
260 catch (
const char *msg)
262 sout <<
"ERROR: " << msg <<
'\n';
265 catch (
const std::exception &e)
267 sout <<
"ERROR: " << e. what () <<
'\n';
272 sout <<
"ABORT: An unknown error occurred.\n";
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...
Elements of the ring Z_p.
A function that creates a filter from a set of cells of different dimensions.
A generic procedure for the computation of the cohomology ring structure for an algebraic minimal mod...
A generic procedure for the computation of an algebraic minimal model of a filtered cell complex stor...
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.
The Shih operator as a component of the Eilenberg-Zilber chain contraction.
A Cartesian product of simplicial cells of arbitrary type.
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.
Tools for coordinate wrapping, a.k.a.
const char * helpinfo
Brief help information on the program's usage.
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...
A class for naming cells for nice text data output.
int main(int argc, char *argv [])
The main procedure of the program.
Hashing keys for std::string.
A simplex class with arbitrary vertices.
The Alexander-Whitney operator as a component of the Eilenberg-Zilber chain contraction.
The decision on whether the empty cell should be used as a valid cell of dimension -1...
void computeAlgMinModel(const tFilteredComplex< CellT > &K, bool relativeComplex, CellArray1 &H, CellArray2 &A, CellArray3 &B, CoefArray &Q, tLinMap< CellT, CellT, CoefT > &pi, tLinMap< CellT, CellT, CoefT > &incl, tLinMap< CellT, CellT, CoefT > &phi, CellNames &homCellNames, CellNames &cohomCellNames, bool displayPi, bool displayIncl, bool displayPhi, bool displayD, bool verify)
Computes the homology of a cellular complex.
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 version of the Alexander-Whitney diagonal for general simplicial sets.
const char * title
The title of the program and licensing information.
The Eilenberg-Mac Lane operator as a component of the Eilenberg-Zilber chain contraction.
An elementary cubical cell with vertex coordinates of integer type.