X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Ftensor.cpp;h=d16bbfce4b7949b85359f926767673c5f66c839f;hp=414225d23d27294b17d86120ec2e12a9a6fb3f81;hb=43e0a8f5ca5e1c48cef5daaf014acdbca4e44568;hpb=7064a931c4b5bea8c4a924fc9e9edabe5584b57a diff --git a/ginac/tensor.cpp b/ginac/tensor.cpp index 414225d2..d16bbfce 100644 --- a/ginac/tensor.cpp +++ b/ginac/tensor.cpp @@ -27,7 +27,9 @@ #include "idx.h" #include "indexed.h" #include "relational.h" +#include "lst.h" #include "numeric.h" +#include "print.h" #include "archive.h" #include "utils.h" #include "debugmsg.h" @@ -438,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); } +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