Symmetric Polynomials  V3.1
A C++ library for generating symmetric polynomials with relations
Symmetric_Basis.hpp
Go to the documentation of this file.
1 #pragma once
2 #include "Polynomials.hpp"
3 #include "Generators.hpp"
4 
11 
12 namespace symmp
13 {
14 
21  template <class T = int64_t, class _deg = int64_t>
22  struct StandardVariables : public std::vector<T>
23  {
24  using std::vector<T>::vector;
25  typedef _deg deg_t;
26 
29  deg_t degree() const;
30 
35  static std::string name(int i, int n);
36 
41 
44  size_t operator()() const;
45  };
46 
53  template <class T = int64_t, class _deg = int64_t>
55  {
57  typedef _deg deg_t;
58 
61  deg_t degree() const;
62 
67  static std::string name(int i, int n);
68  };
69 
80  template <class spec_t, class orig_poly_t, class new_poly_t>
82  {
83  public:
87  new_poly_t operator()(orig_poly_t a) const;
88 
92  orig_poly_t operator()(const new_poly_t &a) const;
93 
96  PolynomialBasis(int num);
97 
99  const std::vector<orig_poly_t> &generators() const;
100 
102  const std::vector<typename new_poly_t::deg_t> &dimensions() const;
103 
105  const std::vector<std::string> &names() const;
106 
109 
110  protected:
112  std::vector<orig_poly_t> _generators;
113 
115  std::vector<typename new_poly_t::deg_t> generator_dimensions;
116 
118  std::vector<std::string> generator_names;
119 
120  private:
121  orig_poly_t compute_product(const typename new_poly_t::exp_t &exponent) const;
122  };
123 
129  template <class x_poly_t, class e_poly_t>
130  class SymmetricBasis : public PolynomialBasis<SymmetricBasis<x_poly_t, e_poly_t>, x_poly_t, e_poly_t>
131  {
132  public:
135  SymmetricBasis(int num);
136 
137  private:
140  typedef typename x_poly_t::exp_t x_t;
141  typedef typename e_poly_t::exp_t e_t;
142  x_poly_t get_elementary_symmetric(int i) const;
143  auto find_exponent(const x_t &term) const -> e_t;
144 
146  friend class PolynomialBasis<SymmetricBasis<x_poly_t, e_poly_t>, x_poly_t, e_poly_t>;
147  };
148 }
149 #include "impl/Symmetric_Basis.ipp"
Contains classes for generating permutations, combinations and a factory for such classes.
Contains the class of polynomials in multiple variables.
Factory class that provides the general interface of a generating basis for a subring of a polynomial...
Definition: Symmetric_Basis.hpp:82
new_poly_t operator()(orig_poly_t a) const
Transform a polynomial on the original variables to one on the generating basis.
std::vector< std::string > generator_names
The names of the generators, optionally constructed in the inheriting class.
Definition: Symmetric_Basis.hpp:118
const int number_of_variables
The number of (the original) variables of the polynomial ring.
Definition: Symmetric_Basis.hpp:108
orig_poly_t operator()(const new_poly_t &a) const
Transform a polynomial on the generating basis into a polynomial on the original variables.
std::vector< orig_poly_t > _generators
The generators of the polynomial basis, constructed in the inheriting class.
Definition: Symmetric_Basis.hpp:112
const std::vector< typename new_poly_t::deg_t > & dimensions() const
Returns vector containing the dimensions of the generating basis (can be empty!)
const std::vector< orig_poly_t > & generators() const
Returns vector containing the generating basis.
const std::vector< std::string > & names() const
Returns vector containing the names of the generating basis (can be empty!)
PolynomialBasis(int num)
Constructor given number of variables.
std::vector< typename new_poly_t::deg_t > generator_dimensions
The dimensions of the generators, optionally constructed in the inheriting class.
Definition: Symmetric_Basis.hpp:115
Class for symmetric polynomials with no relations, allowing transformation from variables to variab...
Definition: Symmetric_Basis.hpp:131
SymmetricBasis(int num)
Constructor given number of variables.
The namespace which contains every method and class in the library.
Definition: General.hpp:16
Variables of degrees .
Definition: Symmetric_Basis.hpp:55
_deg deg_t
Degree typedef.
Definition: Symmetric_Basis.hpp:57
static std::string name(int i, int n)
Returns the name of the variables .
deg_t degree() const
Computes degree of monomial on the .
The standard variables in a polynomial, with and no relations.
Definition: Symmetric_Basis.hpp:23
_deg deg_t
Degree typedef.
Definition: Symmetric_Basis.hpp:25
static std::string name(int i, int n)
Returns the names of the standard variables .
size_t operator()() const
Hashes monomial.
StandardVariables operator+(const StandardVariables &b) const
Multiplies monomials by adding their exponents.
deg_t degree() const
Computes degree of monomial on standard variables .