colorfull is hosted by Hepforge, IPPP Durham
ColorFull  1.1
/data/Documents/eclipse/workspace/ColorFull/Col_amp.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 /*
4  * Col_amp.h
5  * Contains the declarations of the class Col_amp, related types and operators
6  * Created on: Jul 7, 2010
7  * Author: Malin Sjodahl
8  */
9 
10 #ifndef COLORFULL_Col_amp_h
11 #define COLORFULL_Col_amp_h
12 
13 #include "Col_str.h"
14 
15 namespace ColorFull {
16 
19 typedef std::vector<Col_str> col_amp;
20 
21 
24 class Col_amp {
25 
26 public:
27 
29  Col_amp() {Scalar = Scalar * 0;}
30 
38  Col_amp( const std::string str ){Col_amp_of_str( str );}
39 
41  Col_amp( Col_str Cs ) {
42  Scalar = Scalar * 0;
43  ca.push_back(Cs);
44  }
45 
48  col_amp ca;
49 
55 
59  void read_in_Col_amp( std::string filename );
60 
63  void write_out_Col_amp( std::string filename ) const;
64 
66  const Col_str & at( int i ) const{ return ca.at(i); }
67 
69  Col_str & at( int i ) {return ca.at(i);}
70 
72  uint size() const {return ca.size();}
73 
75  bool empty() const { return ca.empty(); }
76 
78  void clear() { ca.clear(); }
79 
81  void erase( int i );
82 
84  void append( Col_str Cs ) {ca.push_back( Cs );}
85 
87  void append( col_amp ca_in );
88 
89 
90  // Functions for probing the Col_amp
91 
93  bool gluons_only() const;
94 
98  int n_gluon() const;
99 
103  int n_quark() const;
104 
107  int n_quark_check() const;
108 
111  int n_gluon_check() const;
112 
114  int longest_quark_line() const;
115 
116  // Functions for manipulating the Col_amp
117 
119  void remove_1_rings();
120 
122  void remove_0_rings();
123 
127  void remove_empty_Col_strs();
128 
131  void collect_col_strs();
132 
134  void normal_order_col_strs();
135 
139  void normal_order();
140 
146  void simplify();
147 
151  void conjugate();
152 
156 
162  void contract_2_rings( );
163 
167 
170  void contract_a_gluon( );
171 
174  void contract_all_gluons( );
175 
178  void contract_quarks( const Col_amp & Ca1, const Col_amp & Ca2 );
179 
180 private:
181 
182 
186  void contract_a_gluon( Col_str & Cs );
187 
194 
202  void contract_Quark_line_gluons( Col_str & Cs );
203 
208  void contract_all_gluons( Col_str & Cs );
209 
216  void Col_amp_of_str( const std::string str );
217 
218 };
219 
220 // Define operators involving Col_amp
221 
223 std::ostream& operator<<( std::ostream& out, const col_amp & ca );
224 
226 std::ostream& operator<<( std::ostream& out, const Col_amp & Ca );
227 
229 bool operator==( const Col_amp & Ca1, const Col_amp & Ca2 );
230 
232 bool operator!=( const Col_amp & Ca1, const Col_amp & Ca2 );
233 
235 Col_amp operator+( const Col_amp & Ca, const Col_str & Cs );
236 
238 Col_amp operator+( const Col_str & Cs, const Col_amp & Ca );
239 
242 Col_amp operator+( const Col_amp & Ca1, const Col_amp & Ca2 );
243 
245 Col_amp operator+=( Col_amp & Ca, const Col_str & Cs );
246 
248 Col_amp operator+=( Col_amp & Ca1, const Col_amp & Ca2 );
249 
252 Col_amp operator-( const Col_amp & Ca1, const Col_amp & Ca2 );
253 
255 Col_amp operator-( const Col_amp & Ca, const Col_str & Cs );
256 
258 Col_amp operator-( const Col_amp & Ca, const Col_str & Cs );
259 
261 Col_amp operator*( const Col_amp & Ca, const int i );
262 
264 Col_amp operator*( const int i, const Col_amp & Ca );
265 
267 Col_amp operator*( const Col_amp & Ca, const cnum c );
268 
270 Col_amp operator*( const cnum c, const Col_amp & Ca );
271 
273 Col_amp operator*( const Col_amp & Ca, const double d );
274 
276 Col_amp operator*( const double d, const Col_amp & Ca );
277 
279 Col_amp operator*( const Col_amp & Ca, const Monomial & Mon );
280 
282 Col_amp operator*( const Monomial & Mon, const Col_amp & Ca );
283 
285 Col_amp operator*( const Col_amp & Ca, const Polynomial & Poly );
286 
288 Col_amp operator*( const Polynomial & Poly, const Col_amp & Ca );
289 
291 Col_amp operator*( const Col_amp & Ca, const Quark_line & Ql );
292 
294 Col_amp operator*( const Quark_line & Ql, const Col_amp & Ca );
295 
297 Col_amp operator*( const Col_amp & Ca, const Col_str & Cs );
298 
300 Col_amp operator*( const Col_str & Cs, const Col_amp & Ca );
301 
303 Col_amp operator*( const Col_amp & Ca1, const Col_amp & Ca2 );
304 
306 Col_amp operator*=( Col_amp & Ca1, const Col_amp & Ca2 );
307 
308 }// end namespace ColorFull
309 
310 #endif /* COLORFULL_Col_amp_h */
unsigned int uint
An unsigned int.
Definition: types.h:35
void contract_next_neighboring_gluons()
Polynomial Scalar
Definition: Col_amp.h:54
Definition: Col_amp.h:24
bool gluons_only() const
Checks if the Col_amp only contains gluons, i.e., if all Quark_lines are closed.
col_amp ca
Definition: Col_amp.h:48
Definition: Quark_line.h:31
void append(Col_str Cs)
Appends a Col_str to the data member ca.
Definition: Col_amp.h:84
void erase(int i)
Erases the Col_str at place i.
void contract_all_gluons()
void contract_quarks(const Col_amp &Ca1, const Col_amp &Ca2)
int n_quark_check() const
Col_amp operator*(const Col_amp &Ca, const int i)
Define the operator * for Col_amps and integers.
std::vector< Col_str > col_amp
Definition: Col_amp.h:19
bool operator==(const Col_amp &Ca1, const Col_amp &Ca2)
Define the operator == for two Col_amps.
void normal_order_col_strs()
Normal orders all col_strs in ca.
Col_amp operator+=(Col_amp &Ca, const Col_str &Cs)
Define the operator += for two Col_amp+=Col_str.
int longest_quark_line() const
Returns the length of the longest Quark_line in any Col_str.
void remove_0_rings()
Remove quark_lines with no gluons, they are Nc if closed, and defined to be 1 if open.
void remove_empty_Col_strs()
Definition: Col_amp.h:15
Definition: Polynomial.h:30
void write_out_Col_amp(std::string filename) const
Col_amp(const std::string str)
Definition: Col_amp.h:38
std::ostream & operator<<(std::ostream &out, const col_amp &ca)
Define the operator << for col_amp.
void remove_1_rings()
Remove Col_strs with quark_lines with just 1 gluon, they are 0 as Tr[t^a]=0.
const Quark_line & at(int i) const
Returns the Quark_line at place i.
Definition: Col_str.h:52
uint size() const
The size of the col_amp ca.
Definition: Col_amp.h:72
void clear()
Erases the information in the col_amp.
Definition: Col_amp.h:78
const Col_str & at(int i) const
Returns the Col_str at place i.
Definition: Col_amp.h:66
void read_in_Col_amp(std::string filename)
Col_amp operator+(const Col_amp &Ca, const Col_str &Cs)
Define the operator + for Col_amp and Col_str, adds Col_str Cs to ca.
std::complex< double > cnum
A complex number, needed as amplitudes in general are complex.
Definition: types.h:20
Definition: Monomial.h:23
void contract_Quark_line_gluons()
Col_amp operator*=(Col_amp &Ca1, const Col_amp &Ca2)
Define the operator *= for two Col_amps.
Col_str & at(int i)
Returns the Col_str at place i.
Definition: Col_amp.h:69
bool empty() const
Is the col_amp empty?
Definition: Col_amp.h:75
bool operator!=(const Col_amp &Ca1, const Col_amp &Ca2)
Define the operator != for two Col_amps.
Col_amp()
Default constructor, sets Scalar=0, and leaves ca empty.
Definition: Col_amp.h:29
Definition: Col_str.h:26
int n_gluon() const
int n_quark() const
Col_amp(Col_str Cs)
Constructor converting a Col_str to a Col_amp.
Definition: Col_amp.h:41
Col_amp operator-(const Col_amp &Ca1, const Col_amp &Ca2)
int n_gluon_check() const