herwig is hosted by Hepforge, IPPP Durham
Herwig 7.3.0
Polynomial.h
1// -*- C++ -*-
2/*
3 * Polynomial.h
4 * Contains declaration of the class Polynomial and associated types and operators.
5 * Created on: Jul 7, 2010
6 * Author: Malin Sjodahl
7 */
8
9#ifndef COLORFULL_Polynomial_h
10#define COLORFULL_Polynomial_h
11
12#include "Monomial.h"
13
14namespace ColorFull {
15
22typedef std::vector < Monomial > polynomial;
23
24
31public:
32
35
40 Polynomial( const std::string str );
41
45 Polynomial( double dnum );
46
50 Polynomial( int num );
51
55 polynomial poly;
56
59 void read_in_Polynomial( std::string filename );
60
63 void write_out_Polynomial( std::string filename ) const;
64
66 const Monomial& at( int i ) const {return poly.at(i);}
67
69 Monomial& at( int i ) {return poly.at(i);}
70
72 int size() const {return poly.size();}
73
75 void append( const Monomial Mon ) {poly.push_back(Mon);}
76
78 void erase( int i ) {poly.erase(poly.begin() + i);}
79
81 bool empty() const {return poly.empty();}
82
84 void clear() {poly.clear();}
85
88 void conjugate();
89
91 void simplify();
92
94 void remove_CF();
95
100
101private:
103 int factorial (int i) const;
104
109 void Polynomial_of_str( const std::string str );
110
111};
112
114std::ostream& operator<<(std::ostream& out, const Polynomial & Poly);
115
117std::ostream& operator<<(std::ostream& out, const polynomial & poly);
118
122bool operator==( const Polynomial & Poly1, const Polynomial & Poly2);
123
126bool operator!=( const Polynomial & Poly1, const Polynomial & Poly2 );
127
129Polynomial operator+(const Polynomial & Poly, const Monomial & Mon );
130
133Polynomial operator+(const Monomial & Mon, const Polynomial & Poly );
134
137Polynomial operator+=( Polynomial & Poly, const Monomial & Mon );
138
141Polynomial operator+=( Polynomial & Poly1, const Polynomial & Poly2 );
142
145Polynomial operator-(const Polynomial & Poly, const Monomial & Mon);
146
150Polynomial operator-(const Monomial & Mon, const Polynomial & Poly);
151
155Polynomial operator+( const Polynomial & Poly1, const Polynomial & Poly2 );
156
159Polynomial operator-(const Polynomial & Poly1, const Polynomial & Poly2);
160
165Polynomial operator*( const Polynomial & Poly, int i );
166
169Polynomial operator*( int i, const Polynomial & Poly );
170
175Polynomial operator*( const Polynomial & Poly, const cnum c );
176
178Polynomial operator*( const cnum c, const Polynomial & Poly );
179
184Polynomial operator*( const Polynomial & Poly, const double d );
185
187Polynomial operator*( const double d, const Polynomial & Poly );
188
192Polynomial operator*( const Polynomial & Poly, const Monomial & Mon );
193
196Polynomial operator*( const Monomial & Mon, const Polynomial & Poly );
197
199Polynomial operator*( const Polynomial & Poly1, const Polynomial & Poly2 );
200
203Polynomial operator*=( Polynomial & Poly, const int i );
204
207Polynomial operator*=( Polynomial & Poly, const double d );
208
211Polynomial operator*=( Polynomial & Poly, const cnum c );
212
215Polynomial operator*=( Polynomial & Poly, const Monomial & Mon );
216
219Polynomial operator*=( Polynomial & Poly1, const Polynomial & Poly2 );
220
221}
222
223
224#endif /* COLORFULL_Polynomial_h */
A class to contain the factor of form TR^a*Nc^b*CF^c*int_part*cnum_part, where the powers a,...
Definition: Monomial.h:23
For containing a Polynomial (in Nc, CF and TR), as a sum of Monomials.
Definition: Polynomial.h:30
Polynomial(double dnum)
Constructor allowing setting the Polynomial using a double.
void Polynomial_of_str(const std::string str)
Function for setting the Polynomial using a string, used by string constructor.
void clear()
Erases info in polynomial.
Definition: Polynomial.h:84
polynomial poly
Contains the polynomial, a sum of Monomials, as an std::vector of Monomials.
Definition: Polynomial.h:55
void append(const Monomial Mon)
Adding a Monomial term.
Definition: Polynomial.h:75
void remove_CF()
Replaces CF with TR*Nc-TR/Nc.
void conjugate()
Take complex conjugate of the polynomial.
Polynomial(int num)
Constructor allowing setting the Polynomial using an int.
void write_out_Polynomial(std::string filename) const
Function for writing out the Polynomial to a file with name filename.
Polynomial(const std::string str)
Constructor allow setting the polynomial by using a string.
Polynomial()
Default constructor, leaves polynomial empty=1.
Definition: Polynomial.h:34
void read_in_Polynomial(std::string filename)
Function for reading in the Polynomial from the file filename, uses Polynomial_of_str.
void normal_order()
Orders terms in Polynomial in a unique form, first according to pow_Nc+pow_CF, then according to pow_...
bool empty() const
Is the polynomial empty?
Definition: Polynomial.h:81
const Monomial & at(int i) const
Returns Monomial at place i.
Definition: Polynomial.h:66
void simplify()
Collects terms with same power of TR and Nc and Cf.
void erase(int i)
Erases the Monomial at place i.
Definition: Polynomial.h:78
int factorial(int i) const
The factorial of an int.
Monomial & at(int i)
Returns Monomial at place i.
Definition: Polynomial.h:69
int size() const
Returns the number of terms in the Polynomial.
Definition: Polynomial.h:72
bool operator==(const LorentzVector< Value > &a, const LorentzVector< Value > &b)
XSecStat operator+(const XSecStat &x1, const XSecStat &x2)
string operator*(double, string)
ostream & operator<<(ostream &, const Collision &)