colorfull is hosted by Hepforge, IPPP Durham
ColorFull  1.1
/data/Documents/eclipse/workspace/ColorFull/Col_str.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*
3  * Col_str.h
4  * Contains declaration of the class Col_str and associated types and operators.
5  * Created on: Jul 7, 2010
6  * Author: Malin Sjodahl
7  */
8 
9 #ifndef COLORFULL_Col_str_h
10 #define COLORFULL_Col_str_h
11 
12 #include "Quark_line.h"
13 
14 namespace ColorFull {
15 
20 typedef std::vector < Quark_line > col_str;
21 
22 
26 class Col_str {
27 public:
28 
30  Col_str(){};
31 
38  Col_str( const std::string str );
39 
41  Col_str( Quark_line Ql ) {cs.push_back(Ql);}
42 
46  col_str cs;
47 
50 
52  const Quark_line & at( int i ) const {return cs.at(i);}
53 
55  Quark_line & at( int i ) {return cs.at(i);}
56 
58  int at( int i, int j ) const;
59 
61  uint size() const{ return cs.size(); }
62 
64  bool empty() const { return cs.empty(); }
65 
67  void clear() { cs.clear(); }
68 
70  void erase( int i );
71 
73  void erase( int i, int j );
74 
76  void erase(std::pair<int, int> place);
77 
79  void append( Quark_line Ql ) { cs.push_back( Ql ); }
80 
83  void insert( int i, int j, int part_num );
84 
86  void append( col_str cs_in );
87 
89  void read_in_Col_str( std::string filename );
90 
93  void write_out_Col_str( std::string filename ) const;
94 
96  std::pair<int, int> find_parton( int part_num ) const;
97 
99  bool neighbor( int p1, int p2 ) const;
100 
102  bool right_neighbor( int p1, int p2 ) const;
103 
105  bool left_neighbor( int p1, int p2 ) const;
106 
108  void replace( int old_ind, int new_ind );
109 
115  std::string find_kind( int p ) const;
116 
118  bool gluons_only() const;
119 
122  int n_gluon() const;
123 
126  int n_quark() const;
127 
133  void normal_order();
134 
148  int smallest( const Col_str & Cs1, const Col_str & Cs2 ) const;
149 
151  int longest_quark_line() const;
152 
154  void remove_1_rings();
155 
157  void remove_0_rings();
158 
163  void simplify();
164 
167  void conjugate();
168 
173 
178  void contract_2_rings( );
179 
182  void contract_quarks( const Col_str Cs1, const Col_str Cs2 );
183 
184 
185 private:
186 
191  int compare_quark_lines( int i1, int i2 ) const;
192 
195  void Col_str_of_str( const std::string str );
196 
200  void col_str_of_str( std::string );
201 
202 }; //end class Col_str
203 
204 
210 bool operator==(const col_str & cs1, const col_str & cs2);
211 
214 bool operator!=(const col_str & cs1, const col_str & cs2);
215 
217 std::ostream& operator<<( std::ostream& out, const col_str & cs );
218 
220 Col_str operator*( const Col_str & Cs, const int i );
221 
223 Col_str operator*( const int i, const Col_str & Cs );
224 
226 Col_str operator*( const Col_str & Cs, const double d );
227 
229 Col_str operator*( const double d, const Col_str & Cs );
230 
232 Col_str operator*( const Col_str & Cs, const cnum c);
233 
235 Col_str operator*( const cnum c, const Col_str & Cs );
236 
238 Col_str operator*( const Col_str & Cs, const Monomial & Mon );
239 
241 Col_str operator*( const Monomial & Mon, const Col_str & Cs);
242 
244 Col_str operator*( const Col_str & Cs, const Polynomial & Poly );
245 
247 Col_str operator*( const Polynomial & Poly, const Col_str & Cs );
248 
250 Col_str operator*( const Col_str & Cs, const Quark_line & Ql);
251 
253 Col_str operator*( const Quark_line & Ql, const Col_str & Cs );
254 
256 Col_str operator*( const Col_str & Cs1, const Col_str & Cs2 );
257 
260 Col_str operator*( const Quark_line & Ql1, const Quark_line & Ql2 );
261 
263 std::ostream& operator<<(std::ostream& out, const Col_str & Cs);
264 
269 bool operator==( const Col_str & Cs1, const Col_str & Cs2 );
270 
273 bool operator!=( const Col_str & Cs1, const Col_str & Cs2 );
274 
275 }
276 
277 #endif /* COLORFULL_Col_str_h */
unsigned int uint
An unsigned int.
Definition: types.h:35
col_str cs
Definition: Col_str.h:46
void clear()
Erase information in col_str.
Definition: Col_str.h:67
Quark_line & at(int i)
Returns the Quark_line at place i.
Definition: Col_str.h:55
void write_out_Col_str(std::string filename) const
int longest_quark_line() const
Returns the length of the longest Quark_line in the Col_str.
void erase(int i)
Erases the Quark_line at place i.
void contract_next_neighboring_gluons()
std::pair< int, int > find_parton(int part_num) const
Locates the parton with number part_num in a Col_str.
Col_str()
Default constructor, leaves cs empty.
Definition: Col_str.h:30
Col_str(Quark_line Ql)
Make a Col_str of a Quark_line.
Definition: Col_str.h:41
void remove_0_rings()
Removes Quark_lines without partons, equal to Nc (closed) or 1 (open).
void append(Quark_line Ql)
Appends a Quark_line to data member cs.
Definition: Col_str.h:79
bool neighbor(int p1, int p2) const
Function for telling if the partons p1 and p2 are neighbors.
Definition: Quark_line.h:31
bool left_neighbor(int p1, int p2) const
Function for telling if parton p2 stands to the left of parton p1.
void read_in_Col_str(std::string filename)
Function for reading in the Col_str from the file filename.
void contract_quarks(const Col_str Cs1, const Col_str Cs2)
Col_amp operator*(const Col_amp &Ca, const int i)
Define the operator * for Col_amps and integers.
int n_quark() const
bool operator==(const Col_amp &Ca1, const Col_amp &Ca2)
Define the operator == for two Col_amps.
int n_gluon() const
Definition: Col_amp.h:15
Definition: Polynomial.h:30
std::ostream & operator<<(std::ostream &out, const col_amp &ca)
Define the operator << for col_amp.
const Quark_line & at(int i) const
Returns the Quark_line at place i.
Definition: Col_str.h:52
int at(int j) const
Polynomial Poly
Polynomial factor multiplying the whole product of quark-lines.
Definition: Col_str.h:49
std::complex< double > cnum
A complex number, needed as amplitudes in general are complex.
Definition: types.h:20
void remove_1_rings()
Removes Quark_lines with only one gluon as Tr(t^a)=0.
Definition: Monomial.h:23
std::vector< Quark_line > col_str
Definition: Col_str.h:20
bool empty() const
Is the col_str empty?
Definition: Col_str.h:64
bool operator!=(const Col_amp &Ca1, const Col_amp &Ca2)
Define the operator != for two Col_amps.
int smallest(const Col_str &Cs1, const Col_str &Cs2) const
std::string find_kind(int p) const
uint size() const
The size of the col_str.
Definition: Col_str.h:61
void insert(int i, int j, int part_num)
void replace(int old_ind, int new_ind)
Replaces the parton index old_ind with new_ind.
Definition: Col_str.h:26
bool right_neighbor(int p1, int p2) const
Function for telling if parton p2 stands to the right of parton p1.
bool gluons_only() const
Checks if the amplitude only has gluons, i.e. if all Quark_lines are closed.