107 inherited::read_archive(n, sym_lst);
115 inherited::archive(n);
132 const color &o =
static_cast<const color &
>(other);
139 return inherited::compare_same_type(other);
145 const color &o =
static_cast<const color &
>(other);
168 for (
auto & it : v) {
204#define TEST_PERMUTATION(A,B,C,P) \
205 if (iv3[B].is_equal(iv2[0]) && iv3[C].is_equal(iv2[1])) { \
217 throw(std::logic_error(
"permute_free_index_to_front(): no valid permutation found"));
228 if (!(
static_cast<const indexed &
>(i).get_dummy_indices().empty()))
236 for (
unsigned j=0; j<3; j++)
242#define CMPINDICES(A,B,C) ((v[0] == (A)) && (v[1] == (B)) && (v[2] == (C)))
277 for (
unsigned j=0; j<3; j++)
280 if (v[0] > v[1]) {
std::swap(v[0], v[1]); sign = -sign; }
281 if (v[0] > v[2]) {
std::swap(v[0], v[2]); sign = -sign; }
282 if (v[1] > v[2]) {
std::swap(v[1], v[2]); sign = -sign; }
310 unsigned char rl =
ex_to<color>(*self).get_representation_label();
316 if (
ex_to<color>(*other).get_representation_label() != rl)
320 if (other - self == 1) {
326 }
else if (other - self == 2
335 while (it != other) {
344 while (it != other) {
371 exvector all_indices = self_indices;
372 all_indices.insert(all_indices.end(), other_indices.begin(), other_indices.end());
373 exvector free_indices, dummy_indices;
377 if (dummy_indices.size() == 3) {
383 }
else if (dummy_indices.size() == 2) {
385 std::back_insert_iterator<exvector> ita(a);
386 ita = set_difference(self_indices.begin(), self_indices.end(), dummy_indices.begin(), dummy_indices.end(), ita,
ex_is_less());
387 ita = set_difference(other_indices.begin(), other_indices.end(), dummy_indices.begin(), dummy_indices.end(), ita,
ex_is_less());
397 if (other+1 != v.end()
402 exvector dummy_indices = {other[0].op(1), other[1].op(1)};
430 if (dummy_indices.size() == 3) {
436 }
else if (dummy_indices.size() == 2) {
448 if (other+1 != v.end()
453 exvector dummy_indices = {other[0].op(1), other[1].op(1)};
473 return color(ONE, rl);
481 throw(std::invalid_argument(
"indices of color_T must be of type idx"));
483 throw(std::invalid_argument(
"index dimension for color_T must be 8"));
485 return color(t, a, rl);
493 throw(std::invalid_argument(
"indices of color_f must be of type idx"));
495 throw(std::invalid_argument(
"index dimension for color_f must be 8"));
505 throw(std::invalid_argument(
"indices of color_d must be of type idx"));
507 throw(std::invalid_argument(
"index dimension for color_d must be 8"));
528 return (
unsigned char)ti.
rl;
535 unsigned char rl =
ex_to<color>(e).get_representation_label();
538 if (rls.find(rl) == rls.end())
551 for (
size_t i=0; i<e.
nops(); i++) {
552 const ex &o = e.
op(i);
565 if (rls.find(rl) == rls.end())
573 size_t num = e.
nops();
580 }
else if (num == 3) {
591 const ex &last_index = e.
op(num - 1).
op(1);
592 const ex &next_to_last_index = e.
op(num - 2).
op(1);
597 for (
size_t i=0; i<num-2; i++)
598 v1.push_back(e.
op(i));
601 v2.push_back(
color_T(summation_index, rl));
607 }
else if (e.
nops() > 0) {
620 std::set<unsigned char> rls;
621 for (
auto & it : rll) {
632 std::set<unsigned char> rls;
Archiving of GiNaC expressions.
#define GINAC_ASSERT(X)
Assertion macro for checking invariances.
This class stores all properties needed to record/retrieve the state of one object of class basic (or...
bool find_unsigned(const std::string &name, unsigned &ret, unsigned index=0) const
Retrieve property of type "unsigned" from node.
void add_unsigned(const std::string &name, unsigned value)
Add property of type "unsigned int" to node.
This class is the ABC (abstract base class) of GiNaC's class hierarchy.
virtual size_t nops() const
Number of operands/members.
virtual ex op(size_t i) const
Return operand/member at position i.
const basic & hold() const
Stop further evaluation.
virtual int compare_same_type(const basic &other) const
Returns order relation between two objects of same type.
This class holds a generator T_a or the unity element of the Lie algebra of SU(3),...
return_type_t return_type_tinfo() const override
ex eval_ncmul(const exvector &v) const override
Perform automatic simplification on noncommutative product of color objects.
unsigned char representation_label
Representation label to distinguish independent color matrices coming from separated fermion lines.
void read_archive(const archive_node &n, lst &sym_lst) override
Load (deserialize) the object from an archive node.
void archive(archive_node &n) const override
Save (serialize) the object into archive node.
bool match_same_type(const basic &other) const override
Returns true if the attributes of two objects are similar enough for a match.
color(const ex &b, unsigned char rl=0)
Construct object without any color index.
ex thiscontainer(const exvector &v) const override
Similar to duplicate(), but with a preset sequence.
Lightweight wrapper for GiNaC's symbolic objects.
ex map(map_function &f) const
ex expand(unsigned options=0) const
Expand an expression.
return_type_t return_type_tinfo() const
This class holds one index of an indexed object.
This class holds an indexed expression.
Non-commutative product of expressions.
This class is a wrapper around CLN-numbers within the GiNaC class hierarchy.
Context for default (ginsh-parsable) output.
Context for latex-parsable output.
This class represents the tensor of symmetric su(3) structure constants.
ex eval_indexed(const basic &i) const override
Automatic symbolic evaluation of indexed symmetric structure constant.
bool contract_with(exvector::iterator self, exvector::iterator other, exvector &v) const override
Contraction of an indexed symmetric structure constant with something else.
This class represents the tensor of antisymmetric su(3) structure constants.
ex eval_indexed(const basic &i) const override
Automatic symbolic evaluation of indexed antisymmetric structure constant.
bool contract_with(exvector::iterator self, exvector::iterator other, exvector &v) const override
Contraction of an indexed antisymmetric structure constant with something else.
This class represents the su(3) unity element.
This class represents an su(3) generator.
bool contract_with(exvector::iterator self, exvector::iterator other, exvector &v) const override
Contraction of generator with something else.
This class holds one of GiNaC's predefined special tensors such as the delta and the metric tensors.
#define TEST_PERMUTATION(A, B, C, P)
#define CMPINDICES(A, B, C)
Interface to GiNaC's color (SU(3) Lie algebra) objects.
Interface to GiNaC's indices.
Interface to GiNaC's products of expressions.
const numeric I
Imaginary unit.
ex hold_ncmul(const exvector &v)
const symmetry & symmetric3()
const symmetry & not_symmetric()
container< std::list > lst
ex color_ONE(unsigned char rl)
Create the su(3) unity element.
B & dynallocate(Args &&... args)
Constructs a new (class basic or derived) B object on the heap.
const symmetry & antisymmetric3()
return_type_t make_return_type_t(const unsigned rl=0)
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,...
const numeric sqrt(const numeric &x)
Numeric square root.
attribute_pure const T & ex_to(const ex &e)
Return a reference to the basic-derived class T object embedded in an expression.
GINAC_IMPLEMENT_REGISTERED_CLASS_OPT_T(lst, basic, print_func< print_context >(&lst::do_print). print_func< print_tree >(&lst::do_print_tree)) template<> bool ls GINAC_BIND_UNARCHIVER)(lst)
Specialization of container::info() for lst.
ex color_T(const ex &a, unsigned char rl)
Create an su(3) generator.
ex color_trace(const ex &e, const std::set< unsigned char > &rls)
Calculate color traces over the specified set of representation labels.
ex color_f(const ex &a, const ex &b, const ex &c)
Create an su(3) antisymmetric structure constant.
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...
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
bool is_a(const basic &obj)
Check if obj is a T, including base classes.
ex delta_tensor(const ex &i1, const ex &i2)
Create a delta tensor with specified indices.
static unsigned char get_representation_label(const return_type_t &ti)
Extract representation label from tinfo key (as returned by return_type_tinfo()).
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 color_d(const ex &a, const ex &b, const ex &c)
Create an su(3) symmetric structure constant.
int to_int(const numeric &x)
bool is_exactly_a(const basic &obj)
Check if obj is a T, not including base classes.
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,...
std::vector< ex > exvector
void swap(GiNaC::ex &a, GiNaC::ex &b)
Specialization of std::swap() for ex objects.
Interface to GiNaC's non-commutative products of expressions.
Makes the interface to the underlying bignum package available.
Interface to GiNaC's overloaded operators.
Interface to GiNaC's symbolic exponentiation (basis^exponent).
#define GINAC_IMPLEMENT_REGISTERED_CLASS(classname, supername)
Macro for inclusion in the implementation of each registered class.
To distinguish between different kinds of non-commutative objects.
std::type_info const * tinfo
to distinguish between non-commutative objects of different type.
unsigned rl
to distinguish between non-commutative objects of the same type.
Interface to GiNaC's symbolic objects.
Interface to GiNaC's symmetry definitions.
Interface to several small and furry utilities needed within GiNaC but not of any interest to the use...
#define DEFAULT_PRINT_LATEX(classname, text, latex)
#define DEFAULT_PRINT(classname, text)
#define DEFAULT_CTOR(classname)
#define DEFAULT_COMPARE(classname)