herwig is hosted by Hepforge, IPPP Durham
Herwig 7.3.0
Col_basis.h
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
16namespace ColorFull {
17
19typedef std::vector<Col_amp> col_basis;
20
24class Col_basis {
25
26public:
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
59 dmatr d_spm;
60
63
66
68 bool is_Trace_basis() const {return trace_basis;}
69
71 bool is_Orthogonal_basis() const {return orthogonal_basis;}
72
74 bool is_Tree_level_gluon_basis() const {return tree_level_gluon_basis;}
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
110
114
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
212
220 void read_in_leading_d_spm( std::string filename );
221
230
238 void read_in_P_spm( std::string filename );
239
248
257 void read_in_leading_P_spm( std::string filename );
258
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
295
297 void write_out_leading_P_spm( std::string filename ) const;
298
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
345protected:
346
347 bool trace_basis;
348 bool tree_level_gluon_basis;
349 bool orthogonal_basis;
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
395std::ostream& operator<<( std::ostream& out, const col_basis & cb );
396
397
399std::ostream& operator<<( std::ostream& out, const Col_basis & Cb );
400
401}// end namespace ColorFull
402
403
404#endif /* COLBASIS_H_ */
405
The full color amplitude is Scalar + Cs1+Cs2+Cs3... Col_amp is a class to contain info on several Col...
Definition: Col_amp.h:24
To contain a color basis, where each basis vector is a Col_amp.
Definition: Col_basis.h:24
std::string basis_file_name() const
Returns a standard filename, used for writing out the basis to a file.
int n_quark_check() const
Returns the number of quarks in the Col_basis after checking that each Col_str in each Col_amp has th...
void write_out_leading_d_spm(std::string filename) const
Writes out leading_d_spm to the file filename.
virtual void scalar_product_matrix(bool save_P_spm, bool save_d_spm, bool use_mem)
The underlying function for calculation of scalar product matrices.
bool empty() const
Is the col_basis empty?
Definition: Col_basis.h:86
void read_in_P_spm(std::string filename)
Read in a Polynomial matrix from the file filename and save it as a Poly_matr in the member variable ...
void check_spm() const
Makes consistency checks on the scalar product matrix.
int ng
The number of gluons, initially set to 0 and (possibly) changed with create_basis,...
Definition: Col_basis.h:46
bool is_Tree_level_gluon_basis() const
Is it a Tree_level_gluon_basis?
Definition: Col_basis.h:74
Poly_matr P_spm
To contain the Polynomial version of the scalar product matrix.
Definition: Col_basis.h:53
void append(col_basis cb_in)
Appends the Col_amps in cb_in to the col_basis member cb.
void append(Col_amp Ca)
Appends a Col_amp to the basis, stored in cb.
Definition: Col_basis.h:92
void scalar_product_matrix()
Function for calculating the scalar products matrix.
const Col_amp & at(const int i) const
Returns the Col_amp (basis vector) at place i.
Definition: Col_basis.h:80
Poly_matr leading_P_spm
To contain the Polynomial version of the leading part of the scalar product matrix.
Definition: Col_basis.h:56
virtual std::ostream & write_out_Col_basis_to_stream(std::ostream &out) const
Function for writing out the basis in a human readable format to an ostream.
bool is_Orthogonal_basis() const
Is it an Orthogonal_basis?
Definition: Col_basis.h:71
void write_out_leading_P_spm() const
Writes out leading_P_spm to the standard filename, see spm_file_name.
int nq
The number of qqbar-pairs, initially set to 0 and (possibly) changed with create_basis,...
Definition: Col_basis.h:42
dmatr leading_d_spm
To contain the double version of the leading part of the scalar product matrix.
Definition: Col_basis.h:62
void read_in_P_spm()
Read in a Polynomial matrix from a file with default filename (see spm_file_name) and save it as a Po...
friend std::ostream & operator<<(std::ostream &out, const Col_basis &Cb)
The operator << for Col_basis operator must be able to access the write_out_Col_basis_to_stream opera...
void Col_basis_of_str(std::string str)
Converts a text string (in a file) to a basis, used by the read_in_basis functions.
void write_out_d_spm() const
Writes out d_spm to the standard filename, see spm_file_name.
cnum scalar_product_num_diagonal(const cvec &v1, const cvec &v2)
Calculates the scalar product between numerical (complex) amplitudes v1, v2 using the numerical scala...
Col_amp & at(const int i)
Returns the Col_amp (basis vector) at place i.
Definition: Col_basis.h:83
void read_in_leading_d_spm(std::string filename)
Read in a numerical matrix from the file filename and save it as a double matrix, dmatr,...
void read_in_leading_d_spm()
Read in a numerical matrix from a file with default filename (see spm_file_name) and save it as a dou...
virtual void write_out_Col_basis() const
Function for writing out the basis to a file with default name (see basis_file_name).
Col_basis()
Default constructor.
Definition: Col_basis.h:29
uint size() const
Returns the number of basis vectors.
Definition: Col_basis.h:77
void read_in_leading_P_spm()
Reads in a Polynomial matrix from default filename (see spm_file_name) and save it as a Poly_matr in ...
void write_out_d_spm(std::string filename) const
Writes out d_spm to the file filename.
void write_out_leading_P_spm(std::string filename) const
Writes out leading_P_spm to the file filename.
bool check_symmetry(const dmatr &matr) const
Checking that a numerical (double) matrix (the scalar product matrix) is symmetric.
Col_functions Col_fun
To contain the set of Col_functions used.
Definition: Col_basis.h:65
virtual void write_out_Col_basis(std::string filename) const
Function for writing out the basis to a file with name filename.
virtual cnum scalar_product_num(const cvec &v1, const cvec &v2)
Calculates the scalar product between numerical (complex) amplitudes v1, V2 using the numerical scala...
void read_in_d_spm()
Read in a numerical matrix from a file with default filename (see spm_file_name) and save it as a dou...
void scalar_product_matrix_num()
This function works as scalar_product_matrix, but does the calculation numerically.
void scalar_product_matrix_num_no_mem()
This function works like scalar_product_matrix_num, but does not use memoization.
virtual Polynomial scalar_product(const Col_amp &Ca1, const Col_amp &Ca2)
Function for calculating scalar products algebraically using the basis and the scalar product matrix ...
void rename_indices(Col_str &Cs1, Col_str &Cs2) const
A function to rename the indices in two Col_strs, such that in the first they are called 1,...
virtual void scalar_product_matrix_no_mem()
This function works like scalar_product_matrix, but does not use memoization.
void write_out_P_spm(std::string filename) const
Writes out P_spm to the file filename.
bool check_diagonal(const dmatr &matr) const
Checking that a numerical (double) matrix is diagonal.
Col_amp exchange_gluon(uint vec, int p1, int p2)
Function for finding the resulting Col_amp after exchanging a gluon between parton p1 and parton p2 i...
int n_gluon_check() const
Returns the number of gluons in the Col_basis after checking that each Col_str in each Col_amp has th...
Poly_matr color_gamma(int p1, int p2)
Function for calculating the color structure part of the soft anomalous dimension matrix.
dmatr d_spm
To contain the double version of the scalar product matrix.
Definition: Col_basis.h:59
virtual ~Col_basis()
Destructor.
Definition: Col_basis.h:38
void write_out_leading_d_spm() const
Writes out leading_d_spm to the standard filename, see spm_file_name.
void write_out_P_spm() const
Writes out P_spm to the standard filename, see spm_file_name.
col_basis cb
To actually contain the info about the basis vectors cb= vector1, vector2... .
Definition: Col_basis.h:50
void clear()
Erase the basis, stored in cb.
Definition: Col_basis.h:89
void leading_scalar_product_matrix()
Finds the leading Nc scalar product matrices, leading_P_spm and leading_d_spm.
bool is_Trace_basis() const
Is it a Trace_basis?
Definition: Col_basis.h:68
virtual Polynomial ij_entry(const int i, const int j) const
Calculates element i,j in scalar product matrix using the scalar product.
virtual cnum scalar_product_num(const Col_amp &Ca1, const Col_amp &Ca2)
Function for calculating scalar products numerically, knowing the basis and the scalar product matrix...
void read_in_d_spm(std::string filename)
Read in a numerical matrix from a file filename (see spm_file_name) and save it as a double matrix,...
void simplify()
Simplifies all the basis vectors by using simplify on the individual Col_amps in the basis.
void read_in_leading_P_spm(std::string filename)
Read in a Polynomial matrix from a file with default filename (see spm_file_name) and save it as a Po...
virtual void read_in_Col_basis(std::string filename)
Function for reading in the basis from the file filename.
virtual void read_in_Col_basis()
Function for reading in the basis from default filename (see basis_file_name).
virtual Poly_vec decompose(const Col_amp &Ca)
Each type of color basis has to implement a function for decomposing an amplitude in the color basis.
std::string spm_file_name(const bool leading, const bool poly) const
Returns a standard filename, used for writing out scalar product matrices.
Library class containing functions for index contraction and numerical evaluation.
Definition: Col_functions.h:25
A class to contain ONE color structure, a direct product of Quark_lines, multiplying a Polynomial,...
Definition: Col_str.h:26
Class for containing a Polynomial matrix, and functions for Polynomial matrices.
Definition: Poly_matr.h:26
Class for containing vector of Polynomials, and functions for Polynomial vectors.
Definition: Poly_vec.h:25
For containing a Polynomial (in Nc, CF and TR), as a sum of Monomials.
Definition: Polynomial.h:30
ostream & operator<<(ostream &, const Collision &)