Package madgraph :: Package core :: Module color_algebra :: Class ColorString
[hide private]
[frames] | no frames]

Class ColorString

source code

object --+    
         |    
      list --+
             |
            ColorString

A list of ColorObjects with an implicit multiplication between, together with a Fraction coefficient and a tag to indicate if the coefficient is real or imaginary. ColorStrings can be simplified, by simplifying their elements.

Instance Methods [hide private]
new list
__init__(self, init_list=[], coeff=Fraction(1, 1), is_imaginary=False, Nc_power=0)
Overrides norm list constructor to implement easy modification of coeff, is_imaginary and Nc_power
source code
 
__str__(self)
Returns a standard string representation based on color object representations
source code
 
__repr__(self)
Returns a standard string representation based on color object representations
source code
 
product(self, other)
Multiply self with other.
source code
 
simplify(self)
Simplify the current ColorString by applying simplify rules on each element and building a new ColorFactor to return if necessary
source code
 
add(self, other)
Add string other to current string.
source code
 
complex_conjugate(self)
Returns the complex conjugate of the current color string
source code
 
to_immutable(self)
Returns an immutable object summarizing the color structure of the current color string.
source code
 
from_immutable(self, immutable_rep)
Fill the current object with Color Objects created using an immutable representation.
source code
 
replace_indices(self, repl_dict)
Replace current indices following the rules listed in the replacement dictionary written as {old_index:new_index,...
source code
 
create_copy(self)
Returns a real copy of self, non trivial because bug in copy.deepcopy
source code
 
__copy__(self)
Returns a real copy of self, non trivial because bug in copy.deepcopy
source code
 
set_Nc(self, Nc=3)
Returns a tuple, with the first entry being the string coefficient with Nc replaced (by default by 3), and the second one being True or False if the coefficient is imaginary or not.
source code
 
order_summation(self, immutable=None)
Force a specific order for the summation indices in case we have Clebsch Gordan coefficients K6's or K6Bar's This is necessary to correctly recognize later on the equivalent color strings (otherwise the color basis is degenerate) The new ordering is as follow:
source code
 
to_canonical(self, immutable=None)
Returns the canonical representation of the immutable representation (i.e., first index is 1, ...).
source code
 
__eq__(self, col_str)
Check if two color strings are equivalent by checking if their canonical representations and the coefficients are equal.
source code
 
__ne__(self, col_str)
Logical opposite of ea
source code
 
is_similar(self, col_str)
Check if two color strings are similar by checking if their canonical representations and Nc/I powers are equal.
source code
 
near_equivalent(self, col_str)
Check if two color strings are equivalent looking only at the color objects (used in color flow string calculation)
source code

Inherited from list: __add__, __contains__, __delitem__, __delslice__, __ge__, __getattribute__, __getitem__, __getslice__, __gt__, __iadd__, __imul__, __iter__, __le__, __len__, __lt__, __mul__, __new__, __reversed__, __rmul__, __setitem__, __setslice__, __sizeof__, append, count, extend, index, insert, pop, remove, reverse, sort

Inherited from object: __delattr__, __format__, __reduce__, __reduce_ex__, __setattr__, __subclasshook__

Class Variables [hide private]
  coeff = Fraction(1, 1)
  is_imaginary = False
  Nc_power = 0
  canonical = None
hash(x)
  immutable = None
hash(x)

Inherited from list: __hash__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, init_list=[], coeff=Fraction(1, 1), is_imaginary=False, Nc_power=0)
(Constructor)

source code 

Overrides norm list constructor to implement easy modification of coeff, is_imaginary and Nc_power

Returns: new list
Overrides: object.__init__

__str__(self)
(Informal representation operator)

source code 

Returns a standard string representation based on color object representations

Overrides: object.__str__

__repr__(self)
(Representation operator)

source code 

Returns a standard string representation based on color object representations

Overrides: object.__repr__

add(self, other)

source code 

Add string other to current string. ONLY USE WITH SIMILAR STRINGS!

to_immutable(self)

source code 

Returns an immutable object summarizing the color structure of the current color string. Format is ((name1,indices1),...) where name is the class name of the color object and indices a tuple corresponding to its indices. An immutable object, in Python, is built on tuples, strings and numbers, i.e. objects which cannot be modified. Their crucial property is that they can be used as dictionary keys!

replace_indices(self, repl_dict)

source code 

Replace current indices following the rules listed in the replacement dictionary written as {old_index:new_index,...}, does that for ALL color objects.

set_Nc(self, Nc=3)

source code 

Returns a tuple, with the first entry being the string coefficient with Nc replaced (by default by 3), and the second one being True or False if the coefficient is imaginary or not. Raise an error if there are still non trivial color objects.

order_summation(self, immutable=None)

source code 

Force a specific order for the summation indices in case we have Clebsch Gordan coefficients K6's or K6Bar's This is necessary to correctly recognize later on the equivalent color strings (otherwise the color basis is degenerate) The new ordering is as follow:

  1. put K and KBar Clebsch Gordan coefficients at the end of the list of color factors the other factors are re-arranged in the reversed order compared with immutable
  2. rename the summation indices so that they are increasing (starting from 10000) from left to right
  3. finally, after the summation indices have been renamed, replace K6(a,i,j) by K6(a,j,i) and K6Bar(a,i,j) by K6Bar(a,j,i) IF j>i

to_canonical(self, immutable=None)

source code 

Returns the canonical representation of the immutable representation (i.e., first index is 1, ...). This allow for an easy comparison of two color strings, i.e. independently of the actual index names (only relative positions matter). Also returns the conversion dictionary. If no immutable representation is given, use the one build from self.

__eq__(self, col_str)
(Equality operator)

source code 

Check if two color strings are equivalent by checking if their canonical representations and the coefficients are equal.

Overrides: list.__eq__

__ne__(self, col_str)

source code 

Logical opposite of ea

Overrides: list.__ne__