Mackey  V3.3
A C++ library for computing RO(G) graded homology
Abelian.hpp
Go to the documentation of this file.
1 #pragma once
2 #include "Utility/General.hpp"
3 
6 
7 namespace mackey
8 {
10  template<typename T>
11  class AbelianGroup {
12  public:
13 
16  T group;
17 
19  AbelianGroup() = default;
20 
23  AbelianGroup(const T& a);
24 
26  bool istrivial() const;
27 
29  bool iscyclic() const;
30 
32  auto operator[](int i) const;
33 
35  auto& operator[](int i);
36 
38  int number_of_summands() const;
39 
41  bool operator == (const AbelianGroup<T>& G) const;
42 
44  bool operator != (const AbelianGroup<T>& G) const;
45 
48 
50  int order() const;
51 
53  int order(const T& element) const;
54 
56  template<typename Scalar>
57  void normalize(Eigen::Matrix<Scalar, -1, -1>& linmap) const;
58 
60  void normalize(T& element) const;
61 
63  auto span(const T& a, const std::vector<T>& b) const;
64 
66  int isMultiple(const T& a, const T& b) const;
67 
69  std::pair <std::vector<dense_t<T>>, std::vector<dense_t<T>>> all_automorphisms() const;
70 
71  private:
73  void mod_normalize(T& element) const;
74 
76  template<typename S>
77  bool check_isomorphism_p_group(int p, const S& a) const;
78 
80  std::vector<dense_t<T>> aut_p_group(int p) const;
81 
83  std::vector<dense_t<T>> inverses(const std::vector<dense_t<T>>& isos) const;
84 
86  static std::vector<int> primes(int n);
87 
89  int is_p_group() const;
90 
91  template<typename S>
92  friend std::ostream& operator<<(std::ostream& os, const AbelianGroup<S>& A);
93  };
94 
95  template<typename T>
96  std::ostream& operator<<(std::ostream& os, const AbelianGroup<T>& A);
97 }
98 #include "impl/Abelian.ipp"
Contains general functions and vector overloads independent of everything else.
A finitely generated abelian group.
Definition: Abelian.hpp:11
std::pair< std::vector< dense_t< T > >, std::vector< dense_t< T > > > all_automorphisms() const
Returns all automorphisms of the group together with their inverses. Currently only for p-groups and ...
void normalize(Eigen::Matrix< Scalar, -1, -1 > &linmap) const
Normalize linear map whose range is this group (reduce n in Z/n to 0 etc.).
bool operator==(const AbelianGroup< T > &G) const
Compares for isomorphism.
AbelianGroup< T > operator+(const AbelianGroup< T > &G) const
The direct sum of groups. No sorting!
bool iscyclic() const
Returns 1 if group is cyclic.
T group
The group represented as an array of numbers 1,2,3,4... where 1 corresponds to Z and n corresponds to...
Definition: Abelian.hpp:16
friend std::ostream & operator<<(std::ostream &os, const AbelianGroup< S > &A)
AbelianGroup(const T &a)
int order(const T &element) const
The order of an element in the group, provided as an array that expresses it as a linear combination ...
bool operator!=(const AbelianGroup< T > &G) const
Compares for non-isomorphism.
int order() const
The order of the group. Returns 0 if it's infinite.
bool istrivial() const
Returns 1 if group is trivial.
int number_of_summands() const
Returns the number of direct summands of the group.
AbelianGroup()=default
Default constructor (trivial group)
void normalize(T &element) const
Normalizes an element in the group to have minimal amount of signs amongst its multiples.
auto & operator[](int i)
Returns the i-th summand of the group (mutable reference version). If the i-th summand is Z then this...
int isMultiple(const T &a, const T &b) const
Returns k if a=k*b in group. Returns 0 if a is not a multiple of b (so make sure a!...
auto span(const T &a, const std::vector< T > &b) const
Expresses a as a linear combination of elements b[i] in the group. If a is not in their span,...
auto operator[](int i) const
Returns the i-th summand of the group (unmutable). If the i-th summand is Z then this returns 1 and i...
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.
Eigen::Matrix< scalar_t< T >,-1,-1 > dense_t
Dense column major.
Definition: Aliases.hpp:30