78 color::
color(const
ex & b,
unsigned char rl) : inherited(b), representation_label(rl)
85 color::color(
const ex & b,
const ex & i1,
unsigned char rl) : inherited(b, i1), representation_label(rl)
108 inherited::read_archive(
n, sym_lst);
110 n.find_unsigned(
"label", rl);
116 inherited::archive(
n);
133 const color &o =
static_cast<const color &
>(other);
140 return inherited::compare_same_type(other);
146 const color &o =
static_cast<const color &
>(other);
169 for (
auto & it : v) {
170 if (!is_a<su3one>(it.op(0)))
205 #define TEST_PERMUTATION(A,B,C,P) \ 206 if (iv3[B].is_equal(iv2[0]) && iv3[C].is_equal(iv2[1])) { \ 218 throw(std::logic_error(
"permute_free_index_to_front(): no valid permutation found"));
229 if (!(static_cast<const indexed &>(i).get_dummy_indices().empty()))
237 for (
unsigned j=0; j<3; j++)
238 v[j] = ex_to<numeric>(ex_to<idx>(i.
op(j + 1)).get_value()).
to_int();
243 #define CMPINDICES(A,B,C) ((v[0] == (A)) && (v[1] == (B)) && (v[2] == (C))) 278 for (
unsigned j=0; j<3; j++)
279 v[j] = ex_to<numeric>(ex_to<idx>(i.
op(j + 1)).get_value()).
to_int();
281 if (v[0] > v[1]) {
std::swap(v[0], v[1]); sign = -sign; }
282 if (v[0] > v[2]) {
std::swap(v[0], v[2]); sign = -sign; }
283 if (v[1] > v[2]) {
std::swap(v[1], v[2]); sign = -sign; }
311 unsigned char rl = ex_to<color>(*self).get_representation_label();
313 if (is_exactly_a<su3t>(other->op(0))) {
317 if (ex_to<color>(*other).get_representation_label() != rl)
321 if (other -
self == 1) {
327 }
else if (other -
self == 2
328 && is_a<color>(
self[1])) {
336 while (it != other) {
337 if (!is_a<color>(*it)) {
345 while (it != other) {
367 if (is_exactly_a<su3d>(other->op(0))) {
370 exvector self_indices = ex_to<indexed>(*self).get_indices();
371 exvector other_indices = ex_to<indexed>(*other).get_indices();
372 exvector all_indices = self_indices;
373 all_indices.insert(all_indices.end(), other_indices.begin(), other_indices.end());
374 exvector free_indices, dummy_indices;
378 if (dummy_indices.size() == 3) {
384 }
else if (dummy_indices.size() == 2) {
386 std::back_insert_iterator<exvector> ita(a);
387 ita = set_difference(self_indices.begin(), self_indices.end(), dummy_indices.begin(), dummy_indices.end(), ita,
ex_is_less());
388 ita = set_difference(other_indices.begin(), other_indices.end(), dummy_indices.begin(), dummy_indices.end(), ita,
ex_is_less());
395 }
else if (is_exactly_a<su3t>(other->op(0))) {
398 if (other+1 != v.end()
399 && is_exactly_a<su3t>(other[1].op(0))
400 && ex_to<indexed>(*self).has_dummy_index_for(other[1].op(1))) {
402 exvector self_indices = ex_to<indexed>(*self).get_indices();
403 exvector dummy_indices = {other[0].
op(1), other[1].
op(1)};
424 if (is_exactly_a<su3f>(other->op(0))) {
428 dummy_indices = ex_to<indexed>(*self).get_dummy_indices(ex_to<indexed>(*other));
431 if (dummy_indices.size() == 3) {
437 }
else if (dummy_indices.size() == 2) {
446 }
else if (is_exactly_a<su3t>(other->op(0))) {
449 if (other+1 != v.end()
450 && is_exactly_a<su3t>(other[1].op(0))
451 && ex_to<indexed>(*self).has_dummy_index_for(other[1].op(1))) {
453 exvector self_indices = ex_to<indexed>(*self).get_indices();
454 exvector dummy_indices = {other[0].
op(1), other[1].
op(1)};
473 static ex ONE = dynallocate<su3one>();
474 return color(ONE, rl);
479 static ex t = dynallocate<su3t>();
482 throw(std::invalid_argument(
"indices of color_T must be of type idx"));
483 if (!ex_to<idx>(a).get_dim().is_equal(8))
484 throw(std::invalid_argument(
"index dimension for color_T must be 8"));
486 return color(t, a, rl);
491 static ex f = dynallocate<su3f>();
493 if (!is_a<idx>(a) || !is_a<idx>(b) || !is_a<idx>(
c))
494 throw(std::invalid_argument(
"indices of color_f must be of type idx"));
495 if (!ex_to<idx>(a).get_dim().is_equal(8) || !ex_to<idx>(b).get_dim().is_equal(8) || !ex_to<idx>(
c).get_dim().is_equal(8))
496 throw(std::invalid_argument(
"index dimension for color_f must be 8"));
503 static ex d = dynallocate<su3d>();
505 if (!is_a<idx>(a) || !is_a<idx>(b) || !is_a<idx>(
c))
506 throw(std::invalid_argument(
"indices of color_d must be of type idx"));
507 if (!ex_to<idx>(a).get_dim().is_equal(8) || !ex_to<idx>(b).get_dim().is_equal(8) || !ex_to<idx>(
c).get_dim().is_equal(8))
508 throw(std::invalid_argument(
"index dimension for color_d must be 8"));
529 return (
unsigned char)ti.
rl;
534 if (is_a<color>(e)) {
539 if (rls.find(rl) == rls.end())
543 if (is_a<su3one>(e.
op(0)))
548 }
else if (is_exactly_a<mul>(e)) {
552 for (
size_t i=0; i<e.
nops(); i++) {
553 const ex &o = e.
op(i);
561 }
else if (is_exactly_a<ncmul>(e)) {
566 if (rls.find(rl) == rls.end())
571 if (!is_a<ncmul>(e_expanded))
574 size_t num = e.
nops();
581 }
else if (num == 3) {
592 const ex &last_index = e.
op(num - 1).
op(1);
593 const ex &next_to_last_index = e.
op(num - 2).
op(1);
594 idx summation_index(dynallocate<symbol>(), 8);
598 for (
size_t i=0; i<num-2; i++)
599 v1.push_back(e.
op(i));
602 v2.push_back(
color_T(summation_index, rl));
608 }
else if (e.
nops() > 0) {
621 std::set<unsigned char> rls;
622 for (
auto & it : rll) {
624 rls.insert(ex_to<numeric>(it).to_int());
633 std::set<unsigned char> rls;
bool contract_with(exvector::iterator self, exvector::iterator other, exvector &v) const override
Contraction of an indexed antisymmetric structure constant with something else.
#define DEFAULT_PRINT(classname, text)
ex color_d(const ex &a, const ex &b, const ex &c)
Create an su(3) symmetric structure constant.
This class holds a generator T_a or the unity element of the Lie algebra of SU(3), as used for calculations in quantum chromodynamics.
Interface to GiNaC's symbolic exponentiation (basis^exponent).
Non-commutative product of expressions.
unsigned rl
to distinguish between non-commutative objects of the same type.
static unsigned char get_representation_label(const return_type_t &ti)
Extract representation label from tinfo key (as returned by return_type_tinfo()). ...
Interface to GiNaC's symbolic objects.
int to_int(const numeric &x)
print_func< print_dflt >(&diracone::do_print). print_func< print_latex >(&diracone
Interface to GiNaC's symmetry definitions.
const basic & hold() const
Stop further evaluation.
ex expand(unsigned options=0) const
unsigned char representation_label
Representation label to distinguish independent color matrices coming from separated fermion lines...
void do_print(const print_context &c, unsigned level) const
return_type_t return_type_tinfo() const override
Archiving of GiNaC expressions.
color(const ex &b, unsigned char rl=0)
Construct object without any color index.
ex color_trace(const ex &e, const std::set< unsigned char > &rls)
Calculate color traces over the specified set of representation labels.
ex eval_indexed(const basic &i) const override
Automatic symbolic evaluation of indexed symmetric structure constant.
This class is the ABC (abstract base class) of GiNaC's class hierarchy.
This class holds one of GiNaC's predefined special tensors such as the delta and the metric tensors...
bool match_same_type(const basic &other) const override
Returns true if the attributes of two objects are similar enough for a match.
This class represents the tensor of antisymmetric su(3) structure constants.
Interface to GiNaC's products of expressions.
void do_print_latex(const print_latex &c, unsigned level) const
virtual size_t nops() const
Number of operands/members.
Interface to GiNaC's indices.
static bool is_color_tinfo(const return_type_t &ti)
Check whether a given tinfo key (as returned by return_type_tinfo() is that of a color object (with a...
Interface to several small and furry utilities needed within GiNaC but not of any interest to the use...
This class is a wrapper around CLN-numbers within the GiNaC class hierarchy.
const symmetry & antisymmetric3()
void archive(archive_node &n) const override
Save (serialize) the object into archive node.
bool contract_with(exvector::iterator self, exvector::iterator other, exvector &v) const override
Contraction of generator with something else.
This class holds an indexed expression.
void find_free_and_dummy(exvector::const_iterator it, exvector::const_iterator itend, exvector &out_free, exvector &out_dummy)
Given a vector of indices, split them into two vectors, one containing the free indices, the other containing the dummy indices (numeric indices are neither free nor dummy ones).
virtual ex op(size_t i) const
Return operand/member at position i.
#define DEFAULT_PRINT_LATEX(classname, text, latex)
#define GINAC_ASSERT(X)
Assertion macro for checking invariances.
ex hold_ncmul(const exvector &v)
void do_print(const print_context &c, unsigned level) const
This class represents an su(3) generator.
void read_archive(const archive_node &n, lst &sym_lst) override
Load (deserialize) the object from an archive node.
GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(add, expairseq, print_func< print_context >(&add::do_print). print_func< print_latex >(&add::do_print_latex). print_func< print_csrc >(&add::do_print_csrc). print_func< print_tree >(&add::do_print_tree). print_func< print_python_repr >(&add::do_print_python_repr)) add
To distinguish between different kinds of non-commutative objects.
ex map(map_function &f) const
This class represents the su(3) unity element.
std::type_info const * tinfo
to distinguish between non-commutative objects of different type.
std::vector< ex > exvector
#define TEST_PERMUTATION(A, B, C, P)
Interface to GiNaC's overloaded operators.
void do_print(const print_context &c, unsigned level) const
const numeric sqrt(const numeric &x)
Numeric square root.
ex thiscontainer(const exvector &v) const override
#define CMPINDICES(A, B, C)
return_type_t return_type_tinfo() const
#define GINAC_IMPLEMENT_REGISTERED_CLASS(classname, supername)
Macro for inclusion in the implementation of each registered class.
const numeric I
Imaginary unit.
Interface to GiNaC's color (SU(3) Lie algebra) objects.
ex color_f(const ex &a, const ex &b, const ex &c)
Create an su(3) antisymmetric structure constant.
ex color_h(const ex &a, const ex &b, const ex &c)
This returns the linear combination d.a.b.c+I*f.a.b.c.
ex delta_tensor(const ex &i1, const ex &i2)
Create a delta tensor with specified indices.
This class stores all properties needed to record/retrieve the state of one object of class basic (or...
const symmetry & symmetric3()
Lightweight wrapper for GiNaC's symbolic objects.
Interface to GiNaC's non-commutative products of expressions.
static ex permute_free_index_to_front(const exvector &iv3, const exvector &iv2, int &sig)
Given a vector iv3 of three indices and a vector iv2 of two indices that is a subset of iv3...
void do_print(const print_context &c, unsigned level) const
ex color_ONE(unsigned char rl)
Create the su(3) unity element.
virtual int compare_same_type(const basic &other) const
Returns order relation between two objects of same type.
Wrapper template for making GiNaC classes out of STL containers.
This class holds one index of an indexed object.
Makes the interface to the underlying bignum package available.
ex eval_indexed(const basic &i) const override
Automatic symbolic evaluation of indexed antisymmetric structure constant.
This class represents the tensor of symmetric su(3) structure constants.
#define DEFAULT_COMPARE(classname)
#define DEFAULT_CTOR(classname)
bool contract_with(exvector::iterator self, exvector::iterator other, exvector &v) const override
Contraction of an indexed symmetric structure constant with something else.
const symmetry & not_symmetric()
ex color_T(const ex &a, unsigned char rl)
Create an su(3) generator.
void swap(GiNaC::ex &a, GiNaC::ex &b)
Specialization of std::swap() for ex objects.
GINAC_BIND_UNARCHIVER(add)