+ ex dim = ex_to<idx>(i1).get_dim();
+ if (!dim.is_equal(ex_to<idx>(i2).get_dim()))
+ throw(std::invalid_argument("all indices of epsilon tensor must have the same dimension"));
+ if (!ex_to<idx>(i1).get_dim().is_equal(_ex2))
+ throw(std::runtime_error("index dimension of epsilon tensor must match number of indices"));
+
+ return indexed(epsilon, antisymmetric2(), i1, i2);
+}
+
+ex epsilon_tensor(const ex & i1, const ex & i2, const ex & i3)
+{
+ static ex epsilon = (new tensepsilon)->setflag(status_flags::dynallocated);
+
+ if (!is_a<idx>(i1) || !is_a<idx>(i2) || !is_a<idx>(i3))
+ throw(std::invalid_argument("indices of epsilon tensor must be of type idx"));
+
+ ex dim = ex_to<idx>(i1).get_dim();
+ if (!dim.is_equal(ex_to<idx>(i2).get_dim()) || !dim.is_equal(ex_to<idx>(i3).get_dim()))
+ throw(std::invalid_argument("all indices of epsilon tensor must have the same dimension"));
+ if (!ex_to<idx>(i1).get_dim().is_equal(_ex3))
+ throw(std::runtime_error("index dimension of epsilon tensor must match number of indices"));
+
+ return indexed(epsilon, antisymmetric3(), i1, i2, i3);
+}
+
+ex lorentz_eps(const ex & i1, const ex & i2, const ex & i3, const ex & i4, bool pos_sig)
+{
+ static ex epsilon_neg = (new tensepsilon(true, false))->setflag(status_flags::dynallocated);
+ static ex epsilon_pos = (new tensepsilon(true, true))->setflag(status_flags::dynallocated);
+
+ if (!is_a<varidx>(i1) || !is_a<varidx>(i2) || !is_a<varidx>(i3) || !is_a<varidx>(i4))
+ throw(std::invalid_argument("indices of Lorentz epsilon tensor must be of type varidx"));
+
+ ex dim = ex_to<idx>(i1).get_dim();
+ if (!dim.is_equal(ex_to<idx>(i2).get_dim()) || !dim.is_equal(ex_to<idx>(i3).get_dim()) || !dim.is_equal(ex_to<idx>(i4).get_dim()))
+ throw(std::invalid_argument("all indices of epsilon tensor must have the same dimension"));
+ if (!ex_to<idx>(i1).get_dim().is_equal(_ex4))
+ throw(std::runtime_error("index dimension of epsilon tensor must match number of indices"));
+
+ return indexed(pos_sig ? epsilon_pos : epsilon_neg, antisymmetric4(), i1, i2, i3, i4);