]> www.ginac.de Git - ginac.git/blobdiff - ginac/tensor.cpp
- dirac_trace() handles arbitrary expressions (even unexpanded), including
[ginac.git] / ginac / tensor.cpp
index c7a68bf2c1f602c57b311be4899cbdb20e17b083..d16bbfce4b7949b85359f926767673c5f66c839f 100644 (file)
@@ -29,6 +29,7 @@
 #include "relational.h"
 #include "lst.h"
 #include "numeric.h"
 #include "relational.h"
 #include "lst.h"
 #include "numeric.h"
+#include "print.h"
 #include "archive.h"
 #include "utils.h"
 #include "debugmsg.h"
 #include "archive.h"
 #include "utils.h"
 #include "debugmsg.h"
@@ -439,4 +440,16 @@ ex lorentz_eps(const ex & i1, const ex & i2, const ex & i3, const ex & i4, bool
        return indexed(tensepsilon(true, pos_sig), indexed::antisymmetric, i1, i2, i3, i4);
 }
 
        return indexed(tensepsilon(true, pos_sig), indexed::antisymmetric, i1, i2, i3, i4);
 }
 
+ex eps0123(const ex & i1, const ex & i2, const ex & i3, const ex & i4, bool pos_sig)
+{
+       if (!is_ex_of_type(i1, varidx) || !is_ex_of_type(i2, varidx) || !is_ex_of_type(i3, varidx) || !is_ex_of_type(i4, varidx))
+               throw(std::invalid_argument("indices of epsilon tensor must be of type varidx"));
+
+       ex dim = ex_to_idx(i1).get_dim();
+       if (dim.is_equal(4))
+               return lorentz_eps(i1, i2, i3, i4, pos_sig);
+       else
+               return indexed(tensepsilon(true, pos_sig), indexed::antisymmetric, i1, i2, i3, i4);
+}
+
 } // namespace GiNaC
 } // namespace GiNaC