colorfull is hosted by Hepforge, IPPP Durham
ColorFull  1.1
/data/Documents/eclipse/workspace/ColorFull/Col_basis.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*
3  * Col_basis.h
4  * Contains the declarations of the class Col_basis, related types and operators.
5  * Created on: Aug 9, 2012
6  * Author: Malin Sjodahl
7  */
8 
9 #ifndef COLORFULL_Col_basis_h
10 #define COLORFULL_Col_basis_h
11 
12 
13 #include "Col_functions.h"
14 
15 
16 namespace ColorFull {
17 
19 typedef std::vector<Col_amp> col_basis;
20 
24 class Col_basis {
25 
26 public:
27 
30  nq=0;
31  ng=0;
32  trace_basis = false;
33  tree_level_gluon_basis = false;
34  orthogonal_basis = false;
35  }
36 
38  virtual ~Col_basis(){}
39 
42  int nq;
43 
46  int ng;
47 
50  col_basis cb;
51 
54 
57 
60 
63 
66 
68  bool is_Trace_basis() const {return trace_basis;}
69 
71  bool is_Orthogonal_basis() const {return orthogonal_basis;}
72 
75 
77  uint size() const {return cb.size();}
78 
80  const Col_amp & at( const int i ) const{return cb.at(i);}
81 
83  Col_amp & at( const int i ) {return cb.at(i);}
84 
86  bool empty() const { return cb.empty(); }
87 
89  void clear() { cb.clear(); }
90 
92  void append( Col_amp Ca ) { cb.push_back( Ca ); }
93 
95  void append( col_basis cb_in );
96 
97 
98  /******************** Functions for scalar products **********************/
99 
100 
109  void scalar_product_matrix();
110 
114 
117  virtual void scalar_product_matrix_no_mem();
118 
122 
129 
134  virtual Polynomial scalar_product( const Col_amp & Ca1, const Col_amp & Ca2 );
135 
140  virtual cnum scalar_product_num( const Col_amp & Ca1, const Col_amp & Ca2 );
141 
147  virtual cnum scalar_product_num( const cvec & v1, const cvec & v2 );
148 
155  cnum scalar_product_num_diagonal( const cvec & v1, const cvec & v2 );
156 
157 
158  /******************** Functions for reading and writing **********************/
159 
160  // Functions for naming files
161 
164  std::string basis_file_name() const;
165 
171  std::string spm_file_name( const bool leading, const bool poly) const;
172 
187  virtual void read_in_Col_basis( std::string filename );
188 
191  virtual void read_in_Col_basis();
192 
201  void read_in_d_spm( std::string filename );
202 
211  void read_in_d_spm( );
212 
220  void read_in_leading_d_spm( std::string filename );
221 
229  void read_in_leading_d_spm( );
230 
238  void read_in_P_spm( std::string filename );
239 
247  void read_in_P_spm( );
248 
257  void read_in_leading_P_spm( std::string filename );
258 
266  void read_in_leading_P_spm( );
267 
268 
269  // Functions for writing
270 
272  virtual void write_out_Col_basis( std::string filename) const;
273 
276  virtual void write_out_Col_basis() const;
277 
279  void write_out_d_spm( std::string filename ) const;
280 
282  void write_out_d_spm( ) const;
283 
285  void write_out_P_spm( std::string filename ) const;
286 
288  void write_out_P_spm( ) const;
289 
291  void write_out_leading_d_spm( std::string filename ) const;
292 
294  void write_out_leading_d_spm( ) const;
295 
297  void write_out_leading_P_spm( std::string filename ) const;
298 
300  void write_out_leading_P_spm( ) const;
301 
302  /******************** Other functions **********************/
303 
306  void simplify();
307 
310  virtual Poly_vec decompose( const Col_amp & Ca );
311 
315  Col_amp exchange_gluon( uint vec, int p1, int p2 );
316 
327  Poly_matr color_gamma( int p1, int p2 );
328 
332  int n_quark_check() const;
333 
337  int n_gluon_check() const;
338 
341  void rename_indices( Col_str & Cs1, Col_str & Cs2 ) const;
342 
343  /******************** Internal functions **********************/
344 
345 protected:
346 
350 
361  virtual void scalar_product_matrix( bool save_P_spm, bool save_d_spm, bool use_mem );
362 
364  virtual Polynomial ij_entry( const int i, const int j ) const;
365 
369  bool check_diagonal( const dmatr & matr ) const;
370 
374  bool check_symmetry( const dmatr & matr ) const;
375 
377  void check_spm() const;
378 
381  void Col_basis_of_str( std::string str );
382 
385  virtual std::ostream& write_out_Col_basis_to_stream( std::ostream& out ) const;
386 
389  friend std::ostream& operator<<( std::ostream& out, const Col_basis & Cb );
390 
391 };// end class Col_basis
392 
393 
395 std::ostream& operator<<( std::ostream& out, const col_basis & cb );
396 
397 
399 std::ostream& operator<<( std::ostream& out, const Col_basis & Cb );
400 
401 }// end namespace ColorFull
402 
403 
404 #endif /* COLBASIS_H_ */
405 
unsigned int uint
An unsigned int.
Definition: types.h:35
virtual Polynomial scalar_product(const Col_amp &Ca1, const Col_amp &Ca2)
Poly_matr leading_P_spm
To contain the Polynomial version of the leading part of the scalar product matrix.
Definition: Col_basis.h:56
void clear()
Erase the basis, stored in cb.
Definition: Col_basis.h:89
Col_functions Col_fun
To contain the set of Col_functions used.
Definition: Col_basis.h:65
int ng
Definition: Col_basis.h:46
Definition: Col_amp.h:24
void scalar_product_matrix_num()
Col_basis()
Default constructor.
Definition: Col_basis.h:29
std::vector< cnum > cvec
A vector of complex numbers.
Definition: types.h:23
Poly_matr P_spm
To contain the Polynomial version of the scalar product matrix.
Definition: Col_basis.h:53
virtual void scalar_product_matrix_no_mem()
void scalar_product_matrix_num_no_mem()
int nq
Definition: Col_basis.h:42
uint size() const
Returns the number of basis vectors.
Definition: Col_basis.h:77
bool empty() const
Is the col_basis empty?
Definition: Col_basis.h:86
void rename_indices(Col_str &Cs1, Col_str &Cs2) const
void check_spm() const
Makes consistency checks on the scalar product matrix.
std::vector< Col_amp > col_basis
Define a type to store all basis vectors.
Definition: Col_basis.h:19
Definition: Poly_vec.h:25
int n_quark_check() const
void write_out_leading_P_spm() const
Writes out leading_P_spm to the standard filename, see spm_file_name.
bool is_Tree_level_gluon_basis() const
Is it a Tree_level_gluon_basis?
Definition: Col_basis.h:74
cnum scalar_product_num_diagonal(const cvec &v1, const cvec &v2)
int n_gluon_check() const
void append(Col_amp Ca)
Appends a Col_amp to the basis, stored in cb.
Definition: Col_basis.h:92
bool is_Trace_basis() const
Is it a Trace_basis?
Definition: Col_basis.h:68
Definition: Col_basis.h:24
void leading_scalar_product_matrix()
Definition: Col_amp.h:15
Definition: Polynomial.h:30
virtual cnum scalar_product_num(const Col_amp &Ca1, const Col_amp &Ca2)
std::vector< std::vector< double > > dmatr
A matrix of double numbers.
Definition: types.h:32
friend std::ostream & operator<<(std::ostream &out, const Col_basis &Cb)
Define the operator << for Col_basis.
bool is_Orthogonal_basis() const
Is it an Orthogonal_basis?
Definition: Col_basis.h:71
virtual void write_out_Col_basis() const
Definition: Col_functions.h:25
const Col_str & at(int i) const
Returns the Col_str at place i.
Definition: Col_amp.h:66
Col_amp exchange_gluon(uint vec, int p1, int p2)
virtual void read_in_Col_basis()
virtual Poly_vec decompose(const Col_amp &Ca)
std::complex< double > cnum
A complex number, needed as amplitudes in general are complex.
Definition: types.h:20
void write_out_d_spm() const
Writes out d_spm to the standard filename, see spm_file_name.
bool check_diagonal(const dmatr &matr) const
std::string spm_file_name(const bool leading, const bool poly) const
virtual std::ostream & write_out_Col_basis_to_stream(std::ostream &out) const
bool tree_level_gluon_basis
Definition: Col_basis.h:348
col_basis cb
Definition: Col_basis.h:50
void write_out_leading_d_spm() const
Writes out leading_d_spm to the standard filename, see spm_file_name.
const Col_amp & at(const int i) const
Returns the Col_amp (basis vector) at place i.
Definition: Col_basis.h:80
virtual Polynomial ij_entry(const int i, const int j) const
Calculates element i,j in scalar product matrix using the scalar product.
virtual ~Col_basis()
Destructor.
Definition: Col_basis.h:38
dmatr leading_d_spm
To contain the double version of the leading part of the scalar product matrix.
Definition: Col_basis.h:62
std::string basis_file_name() const
Definition: Poly_matr.h:26
Poly_matr color_gamma(int p1, int p2)
Definition: Col_str.h:26
bool trace_basis
Definition: Col_basis.h:347
bool orthogonal_basis
Definition: Col_basis.h:349
dmatr d_spm
To contain the double version of the scalar product matrix.
Definition: Col_basis.h:59
Col_amp & at(const int i)
Returns the Col_amp (basis vector) at place i.
Definition: Col_basis.h:83
void write_out_P_spm() const
Writes out P_spm to the standard filename, see spm_file_name.
void Col_basis_of_str(std::string str)
bool check_symmetry(const dmatr &matr) const