X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Ftensor.cpp;h=d16bbfce4b7949b85359f926767673c5f66c839f;hp=c7a68bf2c1f602c57b311be4899cbdb20e17b083;hb=43e0a8f5ca5e1c48cef5daaf014acdbca4e44568;hpb=50dc516836ac5e91f4f60a60b9a307b375247e7c diff --git a/ginac/tensor.cpp b/ginac/tensor.cpp index c7a68bf2..d16bbfce 100644 --- a/ginac/tensor.cpp +++ b/ginac/tensor.cpp @@ -29,6 +29,7 @@ #include "relational.h" #include "lst.h" #include "numeric.h" +#include "print.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); } +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