GiNaC  1.8.0
color.cpp
Go to the documentation of this file.
1 
5 /*
6  * GiNaC Copyright (C) 1999-2020 Johannes Gutenberg University Mainz, Germany
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 #include "color.h"
24 #include "idx.h"
25 #include "ncmul.h"
26 #include "symmetry.h"
27 #include "operators.h"
28 #include "numeric.h"
29 #include "mul.h"
30 #include "power.h" // for sqrt()
31 #include "symbol.h"
32 #include "archive.h"
33 #include "utils.h"
34 
35 #include <iostream>
36 #include <stdexcept>
37 
38 namespace GiNaC {
39 
41 
44  print_func<print_latex>(&su3one::do_print_latex))
45 
48  print_func<print_latex>(&su3t::do_print))
49 
52  print_func<print_latex>(&su3f::do_print))
53 
56  print_func<print_latex>(&su3d::do_print))
57 
58 // default constructors
61 
62 color::color() : representation_label(0)
63 {
64 }
65 
66 DEFAULT_CTOR(su3one)
67 DEFAULT_CTOR(su3t)
68 DEFAULT_CTOR(su3f)
69 DEFAULT_CTOR(su3d)
70 
71 // other constructors
74 
78 color::color(const ex & b, unsigned char rl) : inherited(b), representation_label(rl)
79 {
80 }
81 
85 color::color(const ex & b, const ex & i1, unsigned char rl) : inherited(b, i1), representation_label(rl)
86 {
87 }
88 
89 color::color(unsigned char rl, const exvector & v) : inherited(not_symmetric(), v), representation_label(rl)
90 {
91 }
92 
93 color::color(unsigned char rl, exvector && v) : inherited(not_symmetric(), std::move(v)), representation_label(rl)
94 {
95 }
96 
98 {
99  return make_return_type_t<color>(representation_label);
100 }
101 
103 // archiving
105 
106 void color::read_archive(const archive_node& n, lst& sym_lst)
107 {
108  inherited::read_archive(n, sym_lst);
109  unsigned rl;
110  n.find_unsigned("label", rl);
112 }
113 
115 {
116  inherited::archive(n);
117  n.add_unsigned("label", representation_label);
118 }
119 
125 
127 // functions overriding virtual functions from base classes
129 
130 int color::compare_same_type(const basic & other) const
131 {
132  GINAC_ASSERT(is_a<color>(other));
133  const color &o = static_cast<const color &>(other);
134 
136  // different representation label
137  return representation_label < o.representation_label ? -1 : 1;
138  }
139 
140  return inherited::compare_same_type(other);
141 }
142 
143 bool color::match_same_type(const basic & other) const
144 {
145  GINAC_ASSERT(is_a<color>(other));
146  const color &o = static_cast<const color &>(other);
147 
149 }
150 
155 
156 DEFAULT_PRINT_LATEX(su3one, "ONE", "\\mathbb{1}")
157 DEFAULT_PRINT(su3t, "T")
158 DEFAULT_PRINT(su3f, "f")
159 DEFAULT_PRINT(su3d, "d")
160 
163 ex color::eval_ncmul(const exvector & v) const
164 {
165  exvector s;
166  s.reserve(v.size());
167 
168  // Remove superfluous ONEs
169  for (auto & it : v) {
170  if (!is_a<su3one>(it.op(0)))
171  s.push_back(it);
172  }
173 
174  if (s.empty())
175  return color(su3one(), representation_label);
176  else
177  return hold_ncmul(s);
178 }
179 
181 {
182  return color(representation_label, v);
183 }
184 
186 {
187  return color(representation_label, std::move(v));
188 }
189 
198 static ex permute_free_index_to_front(const exvector & iv3, const exvector & iv2, int & sig)
199 {
200  GINAC_ASSERT(iv3.size() == 3);
201  GINAC_ASSERT(iv2.size() == 2);
202 
203  sig = 1;
204 
205 #define TEST_PERMUTATION(A,B,C,P) \
206  if (iv3[B].is_equal(iv2[0]) && iv3[C].is_equal(iv2[1])) { \
207  sig = P; \
208  return iv3[A]; \
209  }
210 
211  TEST_PERMUTATION(0,1,2, 1);
212  TEST_PERMUTATION(0,2,1, -1);
213  TEST_PERMUTATION(1,0,2, -1);
214  TEST_PERMUTATION(1,2,0, 1);
215  TEST_PERMUTATION(2,0,1, 1);
216  TEST_PERMUTATION(2,1,0, -1);
217 
218  throw(std::logic_error("permute_free_index_to_front(): no valid permutation found"));
219 }
220 
222 ex su3d::eval_indexed(const basic & i) const
223 {
224  GINAC_ASSERT(is_a<indexed>(i));
225  GINAC_ASSERT(i.nops() == 4);
226  GINAC_ASSERT(is_a<su3d>(i.op(0)));
227 
228  // Convolutions are zero
229  if (!(static_cast<const indexed &>(i).get_dummy_indices().empty()))
230  return _ex0;
231 
232  // Numeric evaluation
233  if (static_cast<const indexed &>(i).all_index_values_are(info_flags::nonnegint)) {
234 
235  // Sort indices
236  int v[3];
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();
239  if (v[0] > v[1]) std::swap(v[0], v[1]);
240  if (v[0] > v[2]) std::swap(v[0], v[2]);
241  if (v[1] > v[2]) std::swap(v[1], v[2]);
242 
243 #define CMPINDICES(A,B,C) ((v[0] == (A)) && (v[1] == (B)) && (v[2] == (C)))
244 
245  // Check for non-zero elements
246  if (CMPINDICES(1,4,6) || CMPINDICES(1,5,7) || CMPINDICES(2,5,6)
247  || CMPINDICES(3,4,4) || CMPINDICES(3,5,5))
248  return _ex1_2;
249  else if (CMPINDICES(2,4,7) || CMPINDICES(3,6,6) || CMPINDICES(3,7,7))
250  return _ex_1_2;
251  else if (CMPINDICES(1,1,8) || CMPINDICES(2,2,8) || CMPINDICES(3,3,8))
252  return sqrt(_ex3)*_ex1_3;
253  else if (CMPINDICES(8,8,8))
254  return sqrt(_ex3)*_ex_1_3;
255  else if (CMPINDICES(4,4,8) || CMPINDICES(5,5,8)
256  || CMPINDICES(6,6,8) || CMPINDICES(7,7,8))
257  return sqrt(_ex3)/_ex_6;
258  else
259  return _ex0;
260  }
261 
262  // No further simplifications
263  return i.hold();
264 }
265 
267 ex su3f::eval_indexed(const basic & i) const
268 {
269  GINAC_ASSERT(is_a<indexed>(i));
270  GINAC_ASSERT(i.nops() == 4);
271  GINAC_ASSERT(is_a<su3f>(i.op(0)));
272 
273  // Numeric evaluation
274  if (static_cast<const indexed &>(i).all_index_values_are(info_flags::nonnegint)) {
275 
276  // Sort indices, remember permutation sign
277  int v[3];
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();
280  int sign = 1;
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; }
284 
285  // Check for non-zero elements
286  if (CMPINDICES(1,2,3))
287  return sign;
288  else if (CMPINDICES(1,4,7) || CMPINDICES(2,4,6)
289  || CMPINDICES(2,5,7) || CMPINDICES(3,4,5))
290  return _ex1_2 * sign;
291  else if (CMPINDICES(1,5,6) || CMPINDICES(3,6,7))
292  return _ex_1_2 * sign;
293  else if (CMPINDICES(4,5,8) || CMPINDICES(6,7,8))
294  return sqrt(_ex3)/2 * sign;
295  else
296  return _ex0;
297  }
298 
299  // No further simplifications
300  return i.hold();
301 }
302 
303 
305 bool su3t::contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const
306 {
307  GINAC_ASSERT(is_a<indexed>(*self));
308  GINAC_ASSERT(is_a<indexed>(*other));
309  GINAC_ASSERT(self->nops() == 2);
310  GINAC_ASSERT(is_a<su3t>(self->op(0)));
311  unsigned char rl = ex_to<color>(*self).get_representation_label();
312 
313  if (is_exactly_a<su3t>(other->op(0))) {
314 
315  // Contraction only makes sense if the representation labels are equal
316  GINAC_ASSERT(is_a<color>(*other));
317  if (ex_to<color>(*other).get_representation_label() != rl)
318  return false;
319 
320  // T.a T.a = 4/3 ONE
321  if (other - self == 1) {
322  *self = numeric(4, 3);
323  *other = color_ONE(rl);
324  return true;
325 
326  // T.a T.b T.a = -1/6 T.b
327  } else if (other - self == 2
328  && is_a<color>(self[1])) {
329  *self = numeric(-1, 6);
330  *other = _ex1;
331  return true;
332 
333  // T.a S T.a = 1/2 Tr(S) - 1/6 S
334  } else {
335  auto it = self + 1;
336  while (it != other) {
337  if (!is_a<color>(*it)) {
338  return false;
339  }
340  it++;
341  }
342 
343  it = self + 1;
344  ex S = _ex1;
345  while (it != other) {
346  S *= *it;
347  *it++ = _ex1;
348  }
349 
350  *self = color_trace(S, rl) * color_ONE(rl) / 2 - S / 6;
351  *other = _ex1;
352  return true;
353  }
354  }
355 
356  return false;
357 }
358 
360 bool su3d::contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const
361 {
362  GINAC_ASSERT(is_a<indexed>(*self));
363  GINAC_ASSERT(is_a<indexed>(*other));
364  GINAC_ASSERT(self->nops() == 4);
365  GINAC_ASSERT(is_a<su3d>(self->op(0)));
366 
367  if (is_exactly_a<su3d>(other->op(0))) {
368 
369  // Find the dummy indices of the contraction
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;
375  find_free_and_dummy(all_indices, free_indices, dummy_indices);
376 
377  // d.abc d.abc = 40/3
378  if (dummy_indices.size() == 3) {
379  *self = numeric(40, 3);
380  *other = _ex1;
381  return true;
382 
383  // d.akl d.bkl = 5/3 delta.ab
384  } else if (dummy_indices.size() == 2) {
385  exvector a;
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());
389  GINAC_ASSERT(a.size() == 2);
390  *self = numeric(5, 3) * delta_tensor(a[0], a[1]);
391  *other = _ex1;
392  return true;
393  }
394 
395  } else if (is_exactly_a<su3t>(other->op(0))) {
396 
397  // d.abc T.b T.c = 5/6 T.a
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))) {
401 
402  exvector self_indices = ex_to<indexed>(*self).get_indices();
403  exvector dummy_indices = {other[0].op(1), other[1].op(1)};
404  int sig;
405  ex a = permute_free_index_to_front(self_indices, dummy_indices, sig);
406  *self = numeric(5, 6);
407  other[0] = color_T(a, ex_to<color>(other[0]).get_representation_label());
408  other[1] = _ex1;
409  return true;
410  }
411  }
412 
413  return false;
414 }
415 
417 bool su3f::contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const
418 {
419  GINAC_ASSERT(is_a<indexed>(*self));
420  GINAC_ASSERT(is_a<indexed>(*other));
421  GINAC_ASSERT(self->nops() == 4);
422  GINAC_ASSERT(is_a<su3f>(self->op(0)));
423 
424  if (is_exactly_a<su3f>(other->op(0))) { // f*d is handled by su3d class
425 
426  // Find the dummy indices of the contraction
427  exvector dummy_indices;
428  dummy_indices = ex_to<indexed>(*self).get_dummy_indices(ex_to<indexed>(*other));
429 
430  // f.abc f.abc = 24
431  if (dummy_indices.size() == 3) {
432  *self = 24;
433  *other = _ex1;
434  return true;
435 
436  // f.akl f.bkl = 3 delta.ab
437  } else if (dummy_indices.size() == 2) {
438  int sign1, sign2;
439  ex a = permute_free_index_to_front(ex_to<indexed>(*self).get_indices(), dummy_indices, sign1);
440  ex b = permute_free_index_to_front(ex_to<indexed>(*other).get_indices(), dummy_indices, sign2);
441  *self = sign1 * sign2 * 3 * delta_tensor(a, b);
442  *other = _ex1;
443  return true;
444  }
445 
446  } else if (is_exactly_a<su3t>(other->op(0))) {
447 
448  // f.abc T.b T.c = 3/2 I T.a
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))) {
452 
453  exvector self_indices = ex_to<indexed>(*self).get_indices();
454  exvector dummy_indices = {other[0].op(1), other[1].op(1)};
455  int sig;
456  ex a = permute_free_index_to_front(self_indices, dummy_indices, sig);
457  *self = numeric(3, 2) * sig * I;
458  other[0] = color_T(a, ex_to<color>(other[0]).get_representation_label());
459  other[1] = _ex1;
460  return true;
461  }
462  }
463 
464  return false;
465 }
466 
468 // global functions
470 
471 ex color_ONE(unsigned char rl)
472 {
473  static ex ONE = dynallocate<su3one>();
474  return color(ONE, rl);
475 }
476 
477 ex color_T(const ex & a, unsigned char rl)
478 {
479  static ex t = dynallocate<su3t>();
480 
481  if (!is_a<idx>(a))
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"));
485 
486  return color(t, a, rl);
487 }
488 
489 ex color_f(const ex & a, const ex & b, const ex & c)
490 {
491  static ex f = dynallocate<su3f>();
492 
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"));
497 
498  return indexed(f, antisymmetric3(), a, b, c);
499 }
500 
501 ex color_d(const ex & a, const ex & b, const ex & c)
502 {
503  static ex d = dynallocate<su3d>();
504 
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"));
509 
510  return indexed(d, symmetric3(), a, b, c);
511 }
512 
513 ex color_h(const ex & a, const ex & b, const ex & c)
514 {
515  return color_d(a, b, c) + I * color_f(a, b, c);
516 }
517 
520 static bool is_color_tinfo(const return_type_t& ti)
521 {
522  return *(ti.tinfo) == typeid(color);
523 }
524 
527 static unsigned char get_representation_label(const return_type_t& ti)
528 {
529  return (unsigned char)ti.rl;
530 }
531 
532 ex color_trace(const ex & e, const std::set<unsigned char> & rls)
533 {
534  if (is_a<color>(e)) {
535 
536  unsigned char rl = ex_to<color>(e).get_representation_label();
537 
538  // Are we taking the trace over this object's representation label?
539  if (rls.find(rl) == rls.end())
540  return e;
541 
542  // Yes, all generators are traceless, except for color_ONE
543  if (is_a<su3one>(e.op(0)))
544  return _ex3;
545  else
546  return _ex0;
547 
548  } else if (is_exactly_a<mul>(e)) {
549 
550  // Trace of product: pull out non-color factors
551  ex prod = _ex1;
552  for (size_t i=0; i<e.nops(); i++) {
553  const ex &o = e.op(i);
555  prod *= color_trace(o, rls);
556  else
557  prod *= o;
558  }
559  return prod;
560 
561  } else if (is_exactly_a<ncmul>(e)) {
562 
563  unsigned char rl = get_representation_label(e.return_type_tinfo());
564 
565  // Are we taking the trace over this string's representation label?
566  if (rls.find(rl) == rls.end())
567  return e;
568 
569  // Yes, expand product if necessary
570  ex e_expanded = e.expand();
571  if (!is_a<ncmul>(e_expanded))
572  return color_trace(e_expanded, rls);
573 
574  size_t num = e.nops();
575 
576  if (num == 2) {
577 
578  // Tr T_a T_b = 1/2 delta_a_b
579  return delta_tensor(e.op(0).op(1), e.op(1).op(1)) / 2;
580 
581  } else if (num == 3) {
582 
583  // Tr T_a T_b T_c = 1/4 h_a_b_c
584  return color_h(e.op(0).op(1), e.op(1).op(1), e.op(2).op(1)) / 4;
585 
586  } else {
587 
588  // Traces of 4 or more generators are computed recursively:
589  // Tr T_a1 .. T_an =
590  // 1/6 delta_a(n-1)_an Tr T_a1 .. T_a(n-2)
591  // + 1/2 h_a(n-1)_an_k Tr T_a1 .. T_a(n-2) T_k
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);
595 
596  exvector v1;
597  v1.reserve(num - 2);
598  for (size_t i=0; i<num-2; i++)
599  v1.push_back(e.op(i));
600 
601  exvector v2 = v1;
602  v2.push_back(color_T(summation_index, rl));
603 
604  return delta_tensor(next_to_last_index, last_index) * color_trace(ncmul(v1), rl) / 6
605  + color_h(next_to_last_index, last_index, summation_index) * color_trace(ncmul(v2), rl) / 2;
606  }
607 
608  } else if (e.nops() > 0) {
609 
610  // Trace maps to all other container classes (this includes sums)
612  return e.map(fcn);
613 
614  } else
615  return _ex0;
616 }
617 
618 ex color_trace(const ex & e, const lst & rll)
619 {
620  // Convert list to set
621  std::set<unsigned char> rls;
622  for (auto & it : rll) {
623  if (it.info(info_flags::nonnegint))
624  rls.insert(ex_to<numeric>(it).to_int());
625  }
626 
627  return color_trace(e, rls);
628 }
629 
630 ex color_trace(const ex & e, unsigned char rl)
631 {
632  // Convert label to set
633  std::set<unsigned char> rls;
634  rls.insert(rl);
635 
636  return color_trace(e, rls);
637 }
638 
639 } // namespace GiNaC
bool contract_with(exvector::iterator self, exvector::iterator other, exvector &v) const override
Contraction of an indexed antisymmetric structure constant with something else.
Definition: color.cpp:417
#define DEFAULT_PRINT(classname, text)
Definition: utils.h:616
ex color_d(const ex &a, const ex &b, const ex &c)
Create an su(3) symmetric structure constant.
Definition: color.cpp:501
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.
Definition: color.h:40
Interface to GiNaC&#39;s symbolic exponentiation (basis^exponent).
Non-commutative product of expressions.
Definition: ncmul.h:32
unsigned rl
to distinguish between non-commutative objects of the same type.
Definition: registrar.h:49
static unsigned char get_representation_label(const return_type_t &ti)
Extract representation label from tinfo key (as returned by return_type_tinfo()). ...
Definition: clifford.cpp:824
Interface to GiNaC&#39;s symbolic objects.
const ex _ex3
Definition: utils.cpp:201
int to_int(const numeric &x)
Definition: numeric.h:302
print_func< print_dflt >(&diracone::do_print). print_func< print_latex >(&diracone
Definition: clifford.cpp:51
Interface to GiNaC&#39;s symmetry definitions.
const basic & hold() const
Stop further evaluation.
Definition: basic.cpp:887
const ex _ex_1_3
Definition: utils.cpp:168
ex expand(unsigned options=0) const
Definition: ex.cpp:73
unsigned char representation_label
Representation label to distinguish independent color matrices coming from separated fermion lines...
Definition: color.h:69
Definition: add.cpp:38
void do_print(const print_context &c, unsigned level) const
return_type_t return_type_tinfo() const override
Definition: color.cpp:97
Definition: ex.h:972
Archiving of GiNaC expressions.
color(const ex &b, unsigned char rl=0)
Construct object without any color index.
Definition: color.cpp:78
ex color_trace(const ex &e, const std::set< unsigned char > &rls)
Calculate color traces over the specified set of representation labels.
Definition: color.cpp:532
ex eval_indexed(const basic &i) const override
Automatic symbolic evaluation of indexed symmetric structure constant.
Definition: color.cpp:222
This class is the ABC (abstract base class) of GiNaC&#39;s class hierarchy.
Definition: basic.h:104
size_t nops() const
Definition: ex.h:135
const ex _ex0
Definition: utils.cpp:177
This class holds one of GiNaC&#39;s predefined special tensors such as the delta and the metric tensors...
Definition: tensor.h:34
bool match_same_type(const basic &other) const override
Returns true if the attributes of two objects are similar enough for a match.
Definition: color.cpp:143
const ex _ex_6
Definition: utils.cpp:140
This class represents the tensor of antisymmetric su(3) structure constants.
Definition: color.h:104
Interface to GiNaC&#39;s products of expressions.
void do_print_latex(const print_latex &c, unsigned level) const
virtual size_t nops() const
Number of operands/members.
Definition: basic.cpp:229
Interface to GiNaC&#39;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...
Definition: color.cpp:520
ex op(size_t i) const
Definition: ex.h:136
Interface to several small and furry utilities needed within GiNaC but not of any interest to the use...
const ex _ex1
Definition: utils.cpp:193
This class is a wrapper around CLN-numbers within the GiNaC class hierarchy.
Definition: numeric.h:81
const symmetry & antisymmetric3()
Definition: symmetry.cpp:380
void archive(archive_node &n) const override
Save (serialize) the object into archive node.
Definition: color.cpp:114
bool contract_with(exvector::iterator self, exvector::iterator other, exvector &v) const override
Contraction of generator with something else.
Definition: color.cpp:305
This class holds an indexed expression.
Definition: indexed.h:39
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).
Definition: idx.cpp:521
virtual ex op(size_t i) const
Return operand/member at position i.
Definition: basic.cpp:238
#define DEFAULT_PRINT_LATEX(classname, text, latex)
Definition: utils.h:622
const ex _ex_1_2
Definition: utils.cpp:164
#define GINAC_ASSERT(X)
Assertion macro for checking invariances.
Definition: assertion.h:33
ex hold_ncmul(const exvector &v)
Definition: ncmul.cpp:614
void do_print(const print_context &c, unsigned level) const
This class represents an su(3) generator.
Definition: color.h:87
void read_archive(const archive_node &n, lst &sym_lst) override
Load (deserialize) the object from an archive node.
Definition: color.cpp:106
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
Definition: add.cpp:40
To distinguish between different kinds of non-commutative objects.
Definition: registrar.h:43
ex map(map_function &f) const
Definition: ex.h:162
This class represents the su(3) unity element.
Definition: color.h:75
std::type_info const * tinfo
to distinguish between non-commutative objects of different type.
Definition: registrar.h:46
std::vector< ex > exvector
Definition: basic.h:46
#define TEST_PERMUTATION(A, B, C, P)
Interface to GiNaC&#39;s overloaded operators.
void do_print(const print_context &c, unsigned level) const
const numeric sqrt(const numeric &x)
Numeric square root.
Definition: numeric.cpp:2475
ex thiscontainer(const exvector &v) const override
Definition: color.cpp:180
#define CMPINDICES(A, B, C)
return_type_t return_type_tinfo() const
Definition: ex.h:231
size_t n
Definition: factor.cpp:1463
#define GINAC_IMPLEMENT_REGISTERED_CLASS(classname, supername)
Macro for inclusion in the implementation of each registered class.
Definition: registrar.h:180
const numeric I
Imaginary unit.
Definition: numeric.cpp:1433
Interface to GiNaC&#39;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.
Definition: color.cpp:489
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.
Definition: color.cpp:513
ex delta_tensor(const ex &i1, const ex &i2)
Create a delta tensor with specified indices.
Definition: tensor.cpp:577
This class stores all properties needed to record/retrieve the state of one object of class basic (or...
Definition: archive.h:48
const symmetry & symmetric3()
Definition: symmetry.cpp:362
Lightweight wrapper for GiNaC&#39;s symbolic objects.
Definition: ex.h:72
Interface to GiNaC&#39;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...
Definition: color.cpp:198
void do_print(const print_context &c, unsigned level) const
ex color_ONE(unsigned char rl)
Create the su(3) unity element.
Definition: color.cpp:471
const ex _ex1_3
Definition: utils.cpp:185
virtual int compare_same_type(const basic &other) const
Returns order relation between two objects of same type.
Definition: basic.cpp:719
Wrapper template for making GiNaC classes out of STL containers.
Definition: container.h:73
This class holds one index of an indexed object.
Definition: idx.h:35
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.
Definition: color.cpp:267
This class represents the tensor of symmetric su(3) structure constants.
Definition: color.h:123
const ex _ex1_2
Definition: utils.cpp:189
#define DEFAULT_COMPARE(classname)
Definition: utils.h:609
void reserve(size_t)
Definition: container.h:54
#define DEFAULT_CTOR(classname)
Definition: utils.h:606
bool contract_with(exvector::iterator self, exvector::iterator other, exvector &v) const override
Contraction of an indexed symmetric structure constant with something else.
Definition: color.cpp:360
size_t c
Definition: factor.cpp:770
const symmetry & not_symmetric()
Definition: symmetry.cpp:350
ex color_T(const ex &a, unsigned char rl)
Create an su(3) generator.
Definition: color.cpp:477
void swap(GiNaC::ex &a, GiNaC::ex &b)
Specialization of std::swap() for ex objects.
Definition: ex.h:976
GINAC_BIND_UNARCHIVER(add)

This page is part of the GiNaC developer's reference. It was generated automatically by doxygen. For an introduction, see the tutorial.