X-Git-Url: https://ginac.de/ginac.git//ginac.git?a=blobdiff_plain;f=ginac%2Fcolor.cpp;h=561f88b1e09d00c71f7b76231143289c1e0949fa;hb=2862087ce55d944c1ac5d37283944b2b37507fd2;hp=45521b7aa9ec13dd8683ff479fc82c37ad139879;hpb=591b85b0697370f2f5f25a29a1e94ff831a02c12;p=ginac.git diff --git a/ginac/color.cpp b/ginac/color.cpp index 45521b7a..561f88b1 100644 --- a/ginac/color.cpp +++ b/ginac/color.cpp @@ -124,12 +124,12 @@ DEFAULT_ARCHIVING(su3f) DEFAULT_ARCHIVING(su3d) ////////// -// functions overriding virtual functions from bases classes +// functions overriding virtual functions from base classes ////////// int color::compare_same_type(const basic & other) const { - GINAC_ASSERT(other.tinfo() == TINFO_color); + GINAC_ASSERT(is_of_type(other, color)); const color &o = static_cast(other); if (representation_label != o.representation_label) { @@ -140,6 +140,14 @@ int color::compare_same_type(const basic & other) const return inherited::compare_same_type(other); } +bool color::match_same_type(const basic & other) const +{ + GINAC_ASSERT(is_of_type(other, color)); + const color &o = static_cast(other); + + return representation_label == o.representation_label; +} + DEFAULT_COMPARE(su3one) DEFAULT_COMPARE(su3t) DEFAULT_COMPARE(su3f) @@ -165,7 +173,7 @@ ex color::simplify_ncmul(const exvector & v) const it++; } - if (s.size() == 0) + if (s.empty()) return color(su3one(), representation_label); else return simplified_ncmul(s); @@ -220,7 +228,7 @@ ex su3d::eval_indexed(const basic & i) const GINAC_ASSERT(is_ex_of_type(i.op(0), su3d)); // Convolutions are zero - if (static_cast(i).get_dummy_indices().size() != 0) + if (!(static_cast(i).get_dummy_indices().empty())) return _ex0(); // Numeric evaluation @@ -565,7 +573,7 @@ ex color_trace(const ex & e, unsigned char rl) exvector v1; v1.reserve(num - 2); - for (int i=0; i