Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef _AWDIAG2D_H_
00032 #define _AWDIAG2D_H_
00033
00034
00035
00036 #include "chomp/system/config.h"
00037 #include "chomp/system/textfile.h"
00038 #include "chomp/struct/hashsets.h"
00039
00040
00041 #include "chaincon/awdiag.h"
00042 #include "chaincon/combchain.h"
00043 #include "chaincon/combtensor.h"
00044 #include "chaincon/comblinmap.h"
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 template <class CellT>
00056 void computeAWdiagonal (const chomp::homology::hashedset<CellT> &H,
00057 const tCombLinMap<CellT, CellT> &pi,
00058 const tCombLinMap<CellT, CellT> &incl,
00059 bool displayDiag, bool verify)
00060 {
00061 using chomp::homology::sout;
00062
00063
00064 int_t Hsize = H. size ();
00065 for (int_t i = 0; i < Hsize; ++ i)
00066 {
00067 if (H [i]. dim () != 2)
00068 continue;
00069 tCombChain<CellT> homGen = incl (H [i]);
00070 tCombTensor<CellT> diag (AWdiagonal (homGen));
00071 if (displayDiag)
00072 {
00073 sout << "A-W diagonal of the cycle "
00074 "corresponding to " << H [i] << ":\n";
00075 int_t size = homGen. size ();
00076 for (int_t j = 0; j < size; ++ j)
00077 {
00078 tCombTensor<CellT> diagGen (AWdiagonal
00079 (tCombChain<CellT> (homGen [j])));
00080 sout << homGen [j] << " -> " <<
00081 diagGen << "\n";
00082 }
00083
00084 }
00085 int_t n = diag. size ();
00086 tCombTensor<CellT> diag1dim;
00087 for (int_t j = 0; j < n; ++ j)
00088 {
00089 if (diag. left (j). dim () != 1)
00090 continue;
00091 if (diag. right (j). dim () != 1)
00092 continue;
00093 diag1dim. add (diag. left (j), diag. right (j));
00094 }
00095 tCombTensor<CellT> diagBoundary;
00096 if (verify)
00097 computeBoundary (diag1dim, diagBoundary);
00098 if (displayDiag)
00099 {
00100 sout << "restricted to 1-dim:\n" << diag1dim << "\n";
00101 if (verify)
00102 {
00103 sout << "its boundary: " <<
00104 diagBoundary << "\n";
00105 }
00106 }
00107 if (verify)
00108 {
00109 if (diagBoundary. empty ())
00110 sout << "Verified: bd AW " << H [i] <<
00111 " = 0.\n";
00112 else
00113 sout << "Failed to verify that bd AW " <<
00114 H [i] << " = 0.\n";
00115 }
00116 tCombTensor<CellT> diagHom (pi (diag1dim));
00117 sout << "A-W decomp of " << H [i] << ": " << diagHom << "\n";
00118 }
00119
00120 return;
00121 }
00122
00123
00124 #endif // _AWDIAG2D_H_
00125