]> www.ginac.de Git - ginac.git/commitdiff
Synced to HEAD:
authorJens Vollinga <vollinga@thep.physik.uni-mainz.de>
Fri, 13 Jul 2007 17:57:07 +0000 (17:57 +0000)
committerJens Vollinga <vollinga@thep.physik.uni-mainz.de>
Fri, 13 Jul 2007 17:57:07 +0000 (17:57 +0000)
Clifford units now honor representation labels [Kisil].

ginac/clifford.cpp

index c7ce8d36b71fec835619894aa776ff81f317d7cc..fe4f19ed44253281b4c6444b95e7381efeb2cb57 100644 (file)
@@ -202,8 +202,21 @@ void clifford::do_print_dflt(const print_dflt & c, unsigned level) const
        if (is_dirac_slash(seq[0])) {
                seq[0].print(c, precedence());
                c.s << "\\";
-       } else
-               this->print_dispatch<inherited>(c, level);
+       } else { // We do not print representation label if it is 0
+               if (representation_label == 0) {
+                       this->print_dispatch<inherited>(c, level);
+               } else { // otherwise we put it before indices in square brackets; the code is borrowed from indexed.cpp 
+                       if (precedence() <= level) {
+                               c.s << '(';
+                       }
+                       seq[0].print(c, precedence());
+                       c.s << '[' << int(representation_label) << ']';
+                       printindices(c, level);
+                       if (precedence() <= level) {
+                               c.s << ')';
+                       }
+               }
+       }
 }
 
 void clifford::do_print_latex(const print_latex & c, unsigned level) const