Mackey  V3.3
A C++ library for computing RO(G) graded homology
Chains.hpp
Go to the documentation of this file.
1 #pragma once
2 #include <vector>
3 #include <ostream>
4 
7 namespace mackey
8 {
9 
11  template <typename _rank, typename _diff>
12  struct Arrow
13  {
14  typedef _rank rank_t;
15  typedef _diff diff_t;
19  Arrow(const rank_t &, const rank_t &, const diff_t &);
20  Arrow() = default;
21  template <typename, typename>
22  friend class Tensor;
23  };
24 
29  template <typename _rank, typename _diff>
30  class Chains
31  {
32  public:
33  typedef _rank rank_t;
34  typedef _diff diff_t;
35  std::vector<rank_t> rank;
36  std::vector<diff_t> diff;
37 
38  Chains() = default;
39 
41  int maxindex() const;
42  Chains(const std::vector<rank_t> &, const std::vector<diff_t> &);
43 
44  void reserve(size_t);
45 
47 
48  void push_back(const rank_t &, const diff_t &);
49 
51  Chains dualize(int = -1) const;
52 
54  bool operator==(const Chains<rank_t, diff_t> &) const;
55  };
56 
58  template <typename rank_t, typename diff_t>
59  std::ostream &operator<<(std::ostream &, const Chains<rank_t, diff_t> &);
60 
67  template <typename _rank, typename _diff>
68  class Junction
69  {
70  public:
71  typedef _rank rank_t;
72  typedef _diff diff_t;
73 
79 
80 
82  Junction(const rank_t &, const rank_t &, const rank_t &, const diff_t &, const diff_t &);
83 
85  Junction() = default;
86 
89 
90  private:
91 
93 
94  void setIn(const Arrow<rank_t, diff_t>&, bool = 1);
95 
96  void setIn(const rank_t&, const diff_t&);
97 
98  void setOut(const Arrow<rank_t, diff_t>&, bool = 1);
99 
100  void setOut(const rank_t&, const diff_t&);
101 
102  template <typename, typename>
103  friend class Tensor;
104  };
105 }
106 #include "impl/Chains.ipp"
A chain complex.
Definition: Chains.hpp:31
Chains()=default
Default constructor.
std::vector< rank_t > rank
rank[i]=rank(C[i])
Definition: Chains.hpp:35
_rank rank_t
The rank type.
Definition: Chains.hpp:33
int maxindex() const
The maximum index of the Chain complex.
std::vector< diff_t > diff
diff[i] is the differential C[i]->C[i-1] (diff[0] is always empty)
Definition: Chains.hpp:36
void push_back(const Arrow< rank_t, diff_t > &)
Chains dualize(int=-1) const
The dual cochain complex reindexed as a Chain complex. Optionally stop at index k (if k=-1 then nonst...
_diff diff_t
The differential type.
Definition: Chains.hpp:34
bool operator==(const Chains< rank_t, diff_t > &) const
Checks equality of Chain complexes.
Chains(const std::vector< rank_t > &, const std::vector< diff_t > &)
Constructor given ranks and diffs.
void push_back(const rank_t &, const diff_t &)
void reserve(size_t)
Consisting of an entering and an exiting differential.
Definition: Chains.hpp:69
_rank rank_t
The rank type.
Definition: Chains.hpp:71
rank_t rank
The rank of the middle group.
Definition: Chains.hpp:74
rank_t rankOut
The rank of the rightmost group.
Definition: Chains.hpp:75
_diff diff_t
The differential type.
Definition: Chains.hpp:72
diff_t diffOut
The exiting differential.
Definition: Chains.hpp:77
diff_t diffIn
The entering differential.
Definition: Chains.hpp:78
rank_t rankIn
The rank of the leftmost group.
Definition: Chains.hpp:76
Junction()=default
Default constructor.
Junction(const Chains< rank_t, diff_t > &, int)
Extract the Junction C[i+1]->C[i]->C[i-1] from the Chains C.
Junction(const rank_t &, const rank_t &, const rank_t &, const diff_t &, const diff_t &)
Construct Junction by directly setting the elements.
Tensor product of chain complexes and more.
Definition: Box.hpp:43
Everything in this library is under this namespace.
Definition: Box.hpp:9
std::ostream & operator<<(std::ostream &, const Chains< rank_t, diff_t > &)
Prints chain complex.
A differential with domain and range.
Definition: Chains.hpp:13
Arrow(const rank_t &, const rank_t &, const diff_t &)
Arrow()=default
_rank rank_t
The rank type.
Definition: Chains.hpp:14
diff_t diff
The differential.
Definition: Chains.hpp:18
rank_t range
Rank of the range of the differential.
Definition: Chains.hpp:17
_diff diff_t
The differential type.
Definition: Chains.hpp:15
rank_t domain
Rank of the domain of the differential.
Definition: Chains.hpp:16