31 #ifndef _AWDIAG2DCOMP_H_ 32 #define _AWDIAG2DCOMP_H_ 36 #include "chomp/system/config.h" 37 #include "chomp/system/textfile.h" 38 #include "chomp/system/timeused.h" 39 #include "chomp/struct/hashsets.h" 56 template <
class CellT,
class LinMap,
class CellNames,
class CellRestrT>
58 const LinMap &pi,
const LinMap &incl, CellNames &cellNames,
59 bool displayDiag,
bool verify,
const CellRestrT &restr)
61 using chomp::homology::sout;
63 typedef typename LinMap::ChainDomType ChainType;
64 typedef typename LinMap::TensorDomType TensorType;
67 int_t Hsize = H. size ();
68 for (int_t i = 0; i < Hsize; ++ i)
70 if (H [i]. dim () != 2)
72 ChainType homGen = incl (H [i]);
77 sout <<
"A-W diagonal of " << cellNames (H [i]) <<
79 int_t size = homGen. size ();
80 for (int_t j = 0; j < size; ++ j)
83 chain. add (homGen. getCell (j));
86 sout << homGen. getCell (j) <<
" -> " <<
91 int_t n = diag. size ();
93 for (int_t j = 0; j < n; ++ j)
95 if (diag. left (j). dim () != 1)
97 if (diag. right (j). dim () != 1)
99 diag1dim. add (diag. left (j), diag. right (j));
101 TensorType diagBoundary;
106 sout <<
"restricted to 1-dim:\n" << diag1dim <<
"\n";
109 sout <<
"its boundary: " <<
110 diagBoundary <<
"\n";
115 if (diagBoundary. empty ())
116 sout <<
"Verified: bd AW " <<
117 cellNames (H [i]) <<
" = 0.\n";
119 sout <<
"Failed to verify that bd AW " <<
120 cellNames (H [i]) <<
" = 0.\n";
122 TensorType diagHom (pi (diag1dim));
123 sout <<
"A-W decomp of " << cellNames (H [i]) <<
": " <<
124 cells2names (diagHom, cellNames, cellNames) <<
"\n";
131 #endif // _AWDIAG2DCOMP_H_ A combinatorial chain, that is, a chain with Z_2 coefficients.
A combinatorial linear map (for coefficients in Z_2).
void computeAWdiagonal2d(const chomp::homology::hashedset< CellT > &H, const LinMap &pi, const LinMap &incl, CellNames &cellNames, bool displayDiag, bool verify, const CellRestrT &restr)
Computes the Alexander-Whithey diagonal for 2-dimensional homology generators.
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...
A combinatorial tensor (for coefficients in Z_2).
NamesT::NameType cells2names(const CellT &in, NamesT &names)
Returns the name of a cell according to the given naming object.
void AWdiagonal(const tCombChain< CellT > &ch, tCombTensor< CellT, CellT > &t)
Computes the Alexander-Whitney diagonal of a chain, using the procedure defined for individual cells...
Alexander-Whitney diagonal of a chain.