* Implementation of GiNaC's clifford algebra (Dirac gamma) objects. */
/*
- * GiNaC Copyright (C) 1999-2008 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2009 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
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <stdexcept>
-
#include "clifford.h"
#include "ex.h"
#include "archive.h"
#include "utils.h"
+#include <stdexcept>
+
namespace GiNaC {
GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(clifford, indexed,
clifford::clifford() : representation_label(0), metric(0), commutator_sign(-1)
{
- tinfo_key = &clifford::tinfo_static;
}
DEFAULT_CTOR(diracone)
* @see dirac_ONE */
clifford::clifford(const ex & b, unsigned char rl) : inherited(b), representation_label(rl), metric(0), commutator_sign(-1)
{
- tinfo_key = &clifford::tinfo_static;
}
/** Construct object with one Lorentz index. This constructor is for internal
clifford::clifford(const ex & b, const ex & mu, const ex & metr, unsigned char rl, int comm_sign) : inherited(b, mu), representation_label(rl), metric(metr), commutator_sign(comm_sign)
{
GINAC_ASSERT(is_a<varidx>(mu));
- tinfo_key = &clifford::tinfo_static;
}
clifford::clifford(unsigned char rl, const ex & metr, int comm_sign, const exvector & v, bool discardable) : inherited(not_symmetric(), v, discardable), representation_label(rl), metric(metr), commutator_sign(comm_sign)
{
- tinfo_key = &clifford::tinfo_static;
}
clifford::clifford(unsigned char rl, const ex & metr, int comm_sign, std::auto_ptr<exvector> vp) : inherited(not_symmetric(), vp), representation_label(rl), metric(metr), commutator_sign(comm_sign)
{
- tinfo_key = &clifford::tinfo_static;
}
return_type_t clifford::return_type_tinfo() const
// archiving
//////////
-clifford::clifford(const archive_node & n, lst & sym_lst) : inherited(n, sym_lst)
+void clifford::read_archive(const archive_node& n, lst& sym_lst)
{
+ inherited::read_archive(n, sym_lst);
unsigned rl;
n.find_unsigned("label", rl);
representation_label = rl;
n.add_unsigned("commutator_sign+1", commutator_sign+1);
}
-DEFAULT_UNARCHIVE(clifford)
-DEFAULT_ARCHIVING(diracone)
-DEFAULT_ARCHIVING(cliffordunit)
-DEFAULT_ARCHIVING(diracgamma)
-DEFAULT_ARCHIVING(diracgamma5)
-DEFAULT_ARCHIVING(diracgammaL)
-DEFAULT_ARCHIVING(diracgammaR)
+GINAC_BIND_UNARCHIVER(clifford);
+GINAC_BIND_UNARCHIVER(diracone);
+GINAC_BIND_UNARCHIVER(diracgamma);
+GINAC_BIND_UNARCHIVER(diracgamma5);
+GINAC_BIND_UNARCHIVER(diracgammaL);
+GINAC_BIND_UNARCHIVER(diracgammaR);
ex clifford::get_metric(const ex & i, const ex & j, bool symmetrised) const
else if (is_a<ncmul>(e) || is_a<mul>(e)) {
// find a Clifford unit with the same metric, delete it and substitute its index
size_t ind = e.nops() + 1;
- for (size_t j = 0; j < e.nops(); j++)
- if (is_a<clifford>(e.op(j)) && ex_to<clifford>(c).same_metric(e.op(j)))
- if (ind > e.nops())
+ for (size_t j = 0; j < e.nops(); j++) {
+ if (is_a<clifford>(e.op(j)) && ex_to<clifford>(c).same_metric(e.op(j))) {
+ if (ind > e.nops()) {
ind = j;
- else
+ }
+ else {
throw(std::invalid_argument("get_clifford_comp(): expression is a Clifford multi-vector"));
+ }
+ }
+ }
if (ind < e.nops()) {
ex S = 1;
bool same_value_index, found_dummy;
same_value_index = ( ex_to<idx>(e.op(ind).op(1)).is_numeric()
&& (ival == ex_to<numeric>(ex_to<idx>(e.op(ind).op(1)).get_value()).to_int()) );
found_dummy = same_value_index;
- for(size_t j=0; j < e.nops(); j++)
- if (j != ind)
- if (same_value_index)
+ for (size_t j=0; j < e.nops(); j++) {
+ if (j != ind) {
+ if (same_value_index) {
S = S * e.op(j);
+ }
else {
exvector ind_vec = ex_to<indexed>(e.op(j)).get_dummy_indices(ex_to<indexed>(e.op(ind)));
if (ind_vec.size() > 0) {
} else
S = S * e.op(j);
}
+ }
+ }
return (found_dummy ? S : 0);
} else
throw(std::invalid_argument("get_clifford_comp(): expression is not a Clifford vector to the given units"));