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) {
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)
GINAC_ASSERT(is_ex_of_type(*self, clifford));
GINAC_ASSERT(is_ex_of_type(*other, indexed));
GINAC_ASSERT(is_ex_of_type(self->op(0), diracgamma));
- unsigned char rl = ex_to_clifford(*self).get_representation_label();
+ unsigned char rl = ex_to<clifford>(*self).get_representation_label();
if (is_ex_of_type(*other, clifford)) {
- ex dim = ex_to_idx(self->op(1)).get_dim();
+ ex dim = ex_to<idx>(self->op(1)).get_dim();
// gamma~mu gamma.mu = dim ONE
if (other - self == 1) {
while (it != other) {
if (!is_ex_of_type(*it, clifford))
return false;
- it++;
+ ++it;
}
it = self + 1;
}
if (it == first)
break;
- it--;
+ --it;
}
if (next_to_last == first)
break;
- next_to_last--;
+ --next_to_last;
}
}
something_changed = true;
}
}
- it++;
+ ++it;
}
}
- if (s.size() == 0)
+ if (s.empty())
return clifford(diracone(), representation_label) * sign;
if (something_changed)
return nonsimplified_ncmul(s) * sign;
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];
{
if (is_ex_of_type(e, clifford)) {
- if (ex_to_clifford(e).get_representation_label() == rl
+ if (ex_to<clifford>(e).get_representation_label() == rl
&& is_ex_of_type(e.op(0), diracone))
return trONE;
else
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
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;
// Stupid recursive bubble sort because we only want to swap adjacent gammas
exvector::iterator it = v.begin(), next_to_last = v.end() - 1;
if (is_ex_of_type(it->op(0), diracgamma5))
- it++;
+ ++it;
while (it != next_to_last) {
if (it[0].op(1).compare(it[1].op(1)) > 0) {
ex save0 = it[0], save1 = it[1];
srl.let_op(i) = (lhs == canonicalize_clifford(sum));
goto next_sym;
}
- it++;
+ ++it;
}
next_sym: ;
}