]> www.ginac.de Git - ginac.git/blobdiff - ginac/clifford.cpp
- replaced the Derivative() function by a more resonable fderivative class;
[ginac.git] / ginac / clifford.cpp
index a6a1333e4c10bd54a2ed6a4e5b0a9cc6dcdf5d1c..8d8c2c63ac25f3711bad03a14432617a3f94a490 100644 (file)
@@ -123,12 +123,12 @@ DEFAULT_ARCHIVING(diracgamma)
 DEFAULT_ARCHIVING(diracgamma5)
 
 //////////
-// functions overriding virtual functions from bases classes
+// functions overriding virtual functions from base classes
 //////////
 
 int clifford::compare_same_type(const basic & other) const
 {
-       GINAC_ASSERT(other.tinfo() == TINFO_clifford);
+       GINAC_ASSERT(is_of_type(other, clifford));
        const clifford &o = static_cast<const clifford &>(other);
 
        if (representation_label != o.representation_label) {
@@ -139,6 +139,14 @@ int clifford::compare_same_type(const basic & other) const
        return inherited::compare_same_type(other);
 }
 
+bool clifford::match_same_type(const basic & other) const
+{
+       GINAC_ASSERT(is_of_type(other, clifford));
+       const clifford &o = static_cast<const clifford &>(other);
+
+       return representation_label == o.representation_label;
+}
+
 DEFAULT_COMPARE(diracone)
 DEFAULT_COMPARE(diracgamma)
 DEFAULT_COMPARE(diracgamma5)
@@ -370,8 +378,8 @@ static ex trace_string(exvector::const_iterator ix, unsigned num)
        exvector v(num - 2);
        int sign = 1;
        ex result;
-       for (int i=1; i<num; i++) {
-               for (int n=1, j=0; n<num; n++) {
+       for (unsigned i=1; i<num; i++) {
+               for (unsigned n=1, j=0; n<num; n++) {
                        if (n == i)
                                continue;
                        v[j++] = ix[n];
@@ -398,7 +406,6 @@ ex dirac_trace(const ex & e, unsigned char rl, const ex & trONE)
                ex prod = _ex1();
                for (unsigned i=0; i<e.nops(); i++) {
                        const ex &o = e.op(i);
-                       unsigned ti = o.return_type_tinfo();
                        if (is_clifford_tinfo(o.return_type_tinfo(), rl))
                                prod *= dirac_trace(o, rl, trONE);
                        else
@@ -440,18 +447,18 @@ ex dirac_trace(const ex & e, unsigned char rl, const ex & trONE)
                        num--;
                        int *iv = new int[num];
                        ex result;
-                       for (int i=0; i<num-3; i++) {
+                       for (unsigned i=0; i<num-3; i++) {
                                ex idx1 = ix[i];
-                               for (int j=i+1; j<num-2; j++) {
+                               for (unsigned j=i+1; j<num-2; j++) {
                                        ex idx2 = ix[j];
-                                       for (int k=j+1; k<num-1; k++) {
+                                       for (unsigned k=j+1; k<num-1; k++) {
                                                ex idx3 = ix[k];
-                                               for (int l=k+1; l<num; l++) {
+                                               for (unsigned l=k+1; l<num; l++) {
                                                        ex idx4 = ix[l];
                                                        iv[0] = i; iv[1] = j; iv[2] = k; iv[3] = l;
                                                        exvector v;
                                                        v.reserve(num - 4);
-                                                       for (int n=0, t=4; n<num; n++) {
+                                                       for (unsigned n=0, t=4; n<num; n++) {
                                                                if (n == i || n == j || n == k || n == l)
                                                                        continue;
                                                                iv[t++] = n;