|
|
|||
File indexing completed on 2026-08-06 09:24:11
0001 // -*- C++ -*- 0002 /* 0003 * Col_basis.h 0004 * Contains the declarations of the class Col_basis, related types and operators. 0005 * Created on: Aug 9, 2012 0006 * Author: Malin Sjodahl 0007 */ 0008 0009 #ifndef COLORFULL_Col_basis_h 0010 #define COLORFULL_Col_basis_h 0011 0012 0013 #include "Col_functions.h" 0014 0015 0016 namespace ColorFull { 0017 0018 /// Define a type to store all basis vectors. 0019 typedef std::vector<Col_amp> col_basis; 0020 0021 /// To contain a color basis, where each basis vector is a Col_amp. 0022 /// Technically the color information is contained 0023 /// in the member cb, which is a vector of Col_amps, a col_basis. 0024 class Col_basis { 0025 0026 public: 0027 0028 /// Default constructor 0029 Col_basis(){ 0030 nq=0; 0031 ng=0; 0032 trace_basis = false; 0033 tree_level_gluon_basis = false; 0034 orthogonal_basis = false; 0035 } 0036 0037 /// Destructor. 0038 virtual ~Col_basis(){} 0039 0040 /// The number of qqbar-pairs, initially set to 0 and (possibly) 0041 /// changed with create_basis, or while reading in the basis. 0042 int nq; 0043 0044 /// The number of gluons, initially set to 0 and (possibly) 0045 /// changed with create_basis, or while reading in the basis. 0046 int ng; 0047 0048 /// To actually contain the info about the basis vectors cb= vector1, vector2... . 0049 /// Technically cb is a col_basis, a vector of Col_amps. 0050 col_basis cb; 0051 0052 /// To contain the Polynomial version of the scalar product matrix. 0053 Poly_matr P_spm; 0054 0055 /// To contain the Polynomial version of the leading part of the scalar product matrix. 0056 Poly_matr leading_P_spm; 0057 0058 /// To contain the double version of the scalar product matrix. 0059 dmatr d_spm; 0060 0061 /// To contain the double version of the leading part of the scalar product matrix. 0062 dmatr leading_d_spm; 0063 0064 /// To contain the set of Col_functions used. 0065 Col_functions Col_fun; 0066 0067 /// Is it a Trace_basis? 0068 bool is_Trace_basis() const {return trace_basis;} 0069 0070 /// Is it an Orthogonal_basis? 0071 bool is_Orthogonal_basis() const {return orthogonal_basis;} 0072 0073 /// Is it a Tree_level_gluon_basis? 0074 bool is_Tree_level_gluon_basis() const {return tree_level_gluon_basis;} 0075 0076 /// Returns the number of basis vectors. 0077 uint size() const {return cb.size();} 0078 0079 /// Returns the Col_amp (basis vector) at place i. 0080 const Col_amp & at( const int i ) const{return cb.at(i);} 0081 0082 /// Returns the Col_amp (basis vector) at place i. 0083 Col_amp & at( const int i ) {return cb.at(i);} 0084 0085 /// Is the col_basis empty? 0086 bool empty() const { return cb.empty(); } 0087 0088 /// Erase the basis, stored in cb. 0089 void clear() { cb.clear(); } 0090 0091 /// Appends a Col_amp to the basis, stored in cb. 0092 void append( Col_amp Ca ) { cb.push_back( Ca ); } 0093 0094 /// Appends the Col_amps in cb_in to the col_basis member cb. 0095 void append( col_basis cb_in ); 0096 0097 0098 /******************** Functions for scalar products **********************/ 0099 0100 0101 /// Function for calculating the scalar products matrix. 0102 /// This function loops over all basis vectors and stores the 0103 /// value of the scalar product between basis vector 0104 /// i and basis vector j in the i,j -entry in P_spm and d_spm. 0105 /// The calculation is done using memoization. 0106 /// The symmetry of the scalar product matrix is not used 0107 /// for the calculation, instead it is checked that the 0108 /// resulting matrix is indeed symmetric. 0109 void scalar_product_matrix(); 0110 0111 /// This function works as scalar_product_matrix, but does the 0112 /// calculation numerically. It hence only calculates d_spm. 0113 void scalar_product_matrix_num(); 0114 0115 /// This function works like scalar_product_matrix, but does 0116 /// not use memoization. 0117 virtual void scalar_product_matrix_no_mem(); 0118 0119 /// This function works like scalar_product_matrix_num, but does 0120 /// not use memoization. 0121 void scalar_product_matrix_num_no_mem(); 0122 0123 /// Finds the leading Nc scalar product matrices, 0124 /// leading_P_spm and leading_d_spm. 0125 /// If the polynomial scalar product matrix, P_spm has 0126 /// been calculated, P_spm is used, otherwise P_spm is first calculated 0127 /// and the leading Nc limit is then taken of P_spm. 0128 void leading_scalar_product_matrix(); 0129 0130 /// Function for calculating scalar products algebraically 0131 /// using the basis and the scalar product matrix (Poly_matr) in the basis. 0132 /// (Does add implicit conjugated part for Tree_level_gluon_basis, 0133 /// as these terms are contained in the matrix of scalar products.) 0134 virtual Polynomial scalar_product( const Col_amp & Ca1, const Col_amp & Ca2 ); 0135 0136 /// Function for calculating scalar products numerically, knowing the basis 0137 /// and the scalar product matrix in numerical form. 0138 /// (Does add implicit conjugated part for Tree_level_gluon_basis, 0139 /// as these terms are contained in the matrix of scalar products.) 0140 virtual cnum scalar_product_num( const Col_amp & Ca1, const Col_amp & Ca2 ); 0141 0142 /// Calculates the scalar product between numerical (complex) amplitudes v1, V2 0143 /// using the numerical scalar product matrix, d_spm. 0144 /// The vectors thus needs to be expressed in the basis contained in cb. 0145 /// (Does add implicit conjugated part for Tree_level_gluon_basis, 0146 /// as these terms are contained in the matrix of scalar products.) 0147 virtual cnum scalar_product_num( const cvec & v1, const cvec & v2 ); 0148 0149 /// Calculates the scalar product between numerical (complex) amplitudes v1, v2 0150 /// using the numerical scalar product matrix, d_spm. 0151 /// Assumes that there are only diagonal contributions. 0152 /// This is useful for calculations in leading Nc limit. 0153 /// (Does add implicit conjugated part for Tree_level_gluon_basis, 0154 /// as these terms are contained in the matrix of scalar products.) 0155 cnum scalar_product_num_diagonal( const cvec & v1, const cvec & v2 ); 0156 0157 0158 /******************** Functions for reading and writing **********************/ 0159 0160 // Functions for naming files 0161 0162 /// Returns a standard filename, used for writing out 0163 /// the basis to a file. 0164 std::string basis_file_name() const; 0165 0166 /// Returns a standard filename, used for writing out 0167 /// scalar product matrices. 0168 /// If leading is true, "_l" is appended to the filename. 0169 /// If "poly" is true "P_" is added to the filename, and if it is 0170 /// false "d_", as in double, is added to the filename. 0171 std::string spm_file_name( const bool leading, const bool poly) const; 0172 0173 /// Function for reading in the basis from the file filename. 0174 /// The basis should be in human readable format, of form:<br> 0175 /// 0 [{1,3,4,2}]<br> 0176 /// 1 [{1,4,3,2}]<br> 0177 /// 2 [{1,2}(3,4)]<br> 0178 /// i.e. first basis vector number 0,1,2..., then 0179 /// the Col_amp corresponding to the basis vector in question. 0180 /// The Col_amps may consist of several Col_strs, for example<br> 0181 /// 0 [(1,2,3,4)]+[(1,4,3,2)]<br> 0182 /// 1 [(1,2,4,3)]+[(1,3,4,2)]<br> 0183 /// 2 [(1,3,4,2)]+[(1,2,4,3)]<br> 0184 /// and each Col_str may also contain a Polynomial. 0185 /// (The Polynomial should multiply the whole col_str, 0186 /// rather than a quark_line inside the []-brackets.) 0187 virtual void read_in_Col_basis( std::string filename ); 0188 0189 /// Function for reading in the basis from default filename 0190 /// (see basis_file_name). 0191 virtual void read_in_Col_basis(); 0192 0193 /// Read in a numerical matrix from a file filename 0194 /// (see spm_file_name) and save it as a double matrix, dmatr, 0195 /// in the member variable d_spm. 0196 /// The file should be in the format<br> 0197 /// {{d11,...,d1n},<br> 0198 /// ...,<br> 0199 /// {dn1,....dnn}},<br> 0200 /// and may contain comment lines starting with # at the top. 0201 void read_in_d_spm( std::string filename ); 0202 0203 /// Read in a numerical matrix from a file with default filename 0204 /// (see spm_file_name) and save it as a double matrix, dmatr, 0205 /// in the member variable d_spm. 0206 /// The file should be in the format 0207 /// {{d11,...,d1n},<br> 0208 /// ...,<br> 0209 /// {dn1,....dnn}},<br> 0210 /// and may contain comment lines starting with # at the top. 0211 void read_in_d_spm( ); 0212 0213 /// Read in a numerical matrix from the file filename and save it as a double matrix, dmatr, 0214 /// in the member variable leading_d_spm. 0215 /// The file should be in the format<br> 0216 /// {{d11,0,...,0},<br> 0217 /// ...,<br> 0218 /// {0,0,....dnn}},<br> 0219 /// and may contain comment lines starting with # at the top. 0220 void read_in_leading_d_spm( std::string filename ); 0221 0222 /// Read in a numerical matrix from a file with default filename (see spm_file_name) 0223 /// and save it as a double matrix, dmatr, in the member variable leading_d_spm. 0224 /// The file should be in the format<br> 0225 /// {{d11,0,...,0},<br> 0226 /// ...,<br> 0227 /// {0,0,....dnn}},<br> 0228 /// and may contain comment lines starting with # at the top. 0229 void read_in_leading_d_spm( ); 0230 0231 /// Read in a Polynomial matrix from the file filename and save it as a Poly_matr 0232 /// in the member variable P_spm. 0233 /// The file should be in the format<br> 0234 /// {{Poly11,...,Poly1n}, <br> 0235 /// ...,<br> 0236 /// {Polyn1,...,Polynn}},<br> 0237 /// and may contain comment lines starting with # at the top. 0238 void read_in_P_spm( std::string filename ); 0239 0240 /// Read in a Polynomial matrix from a file with default filename (see spm_file_name) 0241 /// and save it as a Poly_matr in the member variable P_spm. 0242 /// The file should be in the format<br> 0243 /// {{Poly11,...,Poly1n},<br> 0244 /// ...,<br> 0245 /// {Polyn1,...,Polynn}},<br> 0246 /// and may contain comment lines starting with # at the top. 0247 void read_in_P_spm( ); 0248 0249 /// Read in a Polynomial matrix from a file with default filename 0250 /// (see spm_file_name) and save it as a Poly_matr 0251 /// in the member variable leading_P_spm. 0252 /// The file should be in the format<br> 0253 /// {{Poly11,0...,0},<br> 0254 /// ...,<br> 0255 /// {0,...,Polynn}},<br> 0256 /// and may contain comment lines starting with # at the top. 0257 void read_in_leading_P_spm( std::string filename ); 0258 0259 /// Reads in a Polynomial matrix from default filename (see spm_file_name) 0260 /// and save it as a Poly_matr in the member variable leading_P_spm. 0261 /// The file should be in the format<br> 0262 /// {{Poly11,0...,0},<br> 0263 /// ...,<br> 0264 /// {0,...,Polynn}},<br> 0265 /// and may contain comment lines starting with # at the top. 0266 void read_in_leading_P_spm( ); 0267 0268 0269 // Functions for writing 0270 0271 /// Function for writing out the basis to a file with name filename. 0272 virtual void write_out_Col_basis( std::string filename) const; 0273 0274 /// Function for writing out the basis to a file 0275 /// with default name (see basis_file_name). 0276 virtual void write_out_Col_basis() const; 0277 0278 /// Writes out d_spm to the file filename. 0279 void write_out_d_spm( std::string filename ) const; 0280 0281 /// Writes out d_spm to the standard filename, see spm_file_name. 0282 void write_out_d_spm( ) const; 0283 0284 /// Writes out P_spm to the file filename. 0285 void write_out_P_spm( std::string filename ) const; 0286 0287 /// Writes out P_spm to the standard filename, see spm_file_name. 0288 void write_out_P_spm( ) const; 0289 0290 /// Writes out leading_d_spm to the file filename. 0291 void write_out_leading_d_spm( std::string filename ) const; 0292 0293 /// Writes out leading_d_spm to the standard filename, see spm_file_name. 0294 void write_out_leading_d_spm( ) const; 0295 0296 /// Writes out leading_P_spm to the file filename. 0297 void write_out_leading_P_spm( std::string filename ) const; 0298 0299 /// Writes out leading_P_spm to the standard filename, see spm_file_name. 0300 void write_out_leading_P_spm( ) const; 0301 0302 /******************** Other functions **********************/ 0303 0304 /// Simplifies all the basis vectors by using simplify on the 0305 /// individual Col_amps in the basis. 0306 void simplify(); 0307 0308 /// Each type of color basis has to implement a function for decomposing 0309 /// an amplitude in the color basis. 0310 virtual Poly_vec decompose( const Col_amp & Ca ); 0311 0312 /// Function for finding the resulting Col_amp after exchanging 0313 /// a gluon between parton p1 and parton p2 in the 0314 /// basis vector vec. 0315 Col_amp exchange_gluon( uint vec, int p1, int p2 ); 0316 0317 /// Function for calculating the color structure part of the soft anomalous 0318 /// dimension matrix. First calculates the effect of gluon exchange on a 0319 /// basis vector and then decomposes the result into the basis. 0320 /// For this to work the basis must clearly contain all resulting 0321 /// basis vectors, meaning for example that it can not be 0322 /// used for Tree_level_gluon_basis. 0323 /// The function is only available for the Trace_basis 0324 /// and the Orthogonal_basis classes. 0325 /// The ij-component of the resulting matrix gives the amplitude 0326 /// for ending up in component i if starting in component j. 0327 Poly_matr color_gamma( int p1, int p2 ); 0328 0329 /// Returns the number of quarks in the Col_basis after 0330 /// checking that each Col_str in each Col_amp 0331 /// has the same number of quarks. 0332 int n_quark_check() const; 0333 0334 /// Returns the number of gluons in the Col_basis after 0335 /// checking that each Col_str in each Col_amp 0336 /// has the same number of gluons. 0337 int n_gluon_check() const; 0338 0339 /// A function to rename the indices in two Col_strs, such that in the first 0340 /// they are called 1,2,3..., and in the second the relative order is kept. 0341 void rename_indices( Col_str & Cs1, Col_str & Cs2 ) const; 0342 0343 /******************** Internal functions **********************/ 0344 0345 protected: 0346 0347 bool trace_basis; 0348 bool tree_level_gluon_basis; 0349 bool orthogonal_basis; 0350 0351 /// The underlying function for calculation of scalar product 0352 /// matrices. Calculation depends on the arguments: 0353 /// save_P_spm, save_d_spm and use_mem. 0354 /// If save_P_spm is true the Polynomial scalar product 0355 /// matrix is saved to P_spm. 0356 /// If save_d_spm is true, the numerical scalar product matrix 0357 /// is saved to d_spm. 0358 /// The leading_d_spm is only calculated and written out if save_P_spm is true. 0359 /// If use_mem is true memoization is used 0360 /// in order to calculate a color topology only once. 0361 virtual void scalar_product_matrix( bool save_P_spm, bool save_d_spm, bool use_mem ); 0362 0363 /// Calculates element i,j in scalar product matrix using the scalar product. 0364 virtual Polynomial ij_entry( const int i, const int j ) const; 0365 0366 /// Checking that a numerical (double) matrix is diagonal. 0367 /// Used for the leading version of the scalar product matrix. 0368 /// Returns true if the matrix is diagonal and false otherwise. 0369 bool check_diagonal( const dmatr & matr ) const; 0370 0371 /// Checking that a numerical (double) matrix (the scalar product matrix) 0372 /// is symmetric. 0373 /// Returns true if the matrix is symmetric and false otherwise. 0374 bool check_symmetry( const dmatr & matr ) const; 0375 0376 /// Makes consistency checks on the scalar product matrix. 0377 void check_spm() const; 0378 0379 /// Converts a text string (in a file) to a basis, 0380 /// used by the read_in_basis functions. 0381 void Col_basis_of_str( std::string str ); 0382 0383 /// Function for writing out the basis in a human readable 0384 /// format to an ostream. 0385 virtual std::ostream& write_out_Col_basis_to_stream( std::ostream& out ) const; 0386 0387 /// The operator << for Col_basis operator must be able to access the 0388 /// write_out_Col_basis_to_stream operator. 0389 friend std::ostream& operator<<( std::ostream& out, const Col_basis & Cb ); 0390 0391 };// end class Col_basis 0392 0393 0394 /// Define the operator << for col_basis. 0395 std::ostream& operator<<( std::ostream& out, const col_basis & cb ); 0396 0397 0398 /// Define the operator << for Col_basis. 0399 std::ostream& operator<<( std::ostream& out, const Col_basis & Cb ); 0400 0401 }// end namespace ColorFull 0402 0403 0404 #endif /* COLBASIS_H_ */ 0405
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|