* Implementation of GiNaC's clifford algebra (Dirac gamma) objects. */
/*
- * GiNaC Copyright (C) 1999-2002 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2003 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
GINAC_IMPLEMENT_REGISTERED_CLASS(diracone, tensor)
GINAC_IMPLEMENT_REGISTERED_CLASS(diracgamma, tensor)
GINAC_IMPLEMENT_REGISTERED_CLASS(diracgamma5, tensor)
-
GINAC_IMPLEMENT_REGISTERED_CLASS(diracgammaL, tensor)
GINAC_IMPLEMENT_REGISTERED_CLASS(diracgammaR, tensor)
+
//////////
// default ctor, dtor, copy ctor, assignment operator and helpers
//////////
DEFAULT_CTORS(diracone)
DEFAULT_CTORS(diracgamma)
DEFAULT_CTORS(diracgamma5)
-
DEFAULT_CTORS(diracgammaL)
DEFAULT_CTORS(diracgammaR)
+
//////////
// other constructors
//////////
DEFAULT_ARCHIVING(diracone)
DEFAULT_ARCHIVING(diracgamma)
DEFAULT_ARCHIVING(diracgamma5)
-
DEFAULT_ARCHIVING(diracgammaL)
DEFAULT_ARCHIVING(diracgammaR)
+
//////////
// functions overriding virtual functions from base classes
//////////
GINAC_ASSERT(is_a<diracgamma>(self->op(0)));
unsigned char rl = ex_to<clifford>(*self).get_representation_label();
+ ex dim = ex_to<idx>(self->op(1)).get_dim();
+ if (other->nops() > 1)
+ dim = minimal_dim(dim, ex_to<idx>(self->op(1)).get_dim());
+
if (is_a<clifford>(*other)) {
// Contraction only makes sense if the represenation labels are equal
if (ex_to<clifford>(*other).get_representation_label() != rl)
return false;
- ex dim = ex_to<idx>(self->op(1)).get_dim();
-
// gamma~mu gamma.mu = dim ONE
if (other - self == 1) {
*self = dim;
*other = _ex1;
return true;
}
+
+ } else if (is_a<symbol>(other->op(0)) && other->nops() == 2) {
+
+ // x.mu gamma~mu -> x-slash
+ *self = dirac_slash(other->op(0), dim, rl);
+ *other = _ex1;
+ return true;
}
return false;
} else if (!a_is_diracgamma && !b_is_diracgamma && ag.is_equal(bg)) {
// a\ a\ -> a^2
- varidx ix((new symbol)->setflag(status_flags::dynallocated), ex_to<idx>(a.op(1)).get_dim());
+ varidx ix((new symbol)->setflag(status_flags::dynallocated), ex_to<idx>(a.op(1)).minimal_dim(ex_to<idx>(b.op(1))));
a = indexed(ag, ix) * indexed(ag, ix.toggle_variance());
b = dirac_ONE(representation_label);
something_changed = true;
// 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_a<diracgamma5>(it->op(0)))
+ if (is_a<diracgamma5>(it->op(0)) || is_a<diracgammaL>(it->op(0)) || is_a<diracgammaR>(it->op(0)))
++it;
while (it != next_to_last) {
if (it[0].compare(it[1]) > 0) {