X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=ginac%2Ftensor.cpp;h=0a57ae56b7916a12722808eeb4f08b1f2e9c306a;hp=259af3e45d3a579639f1712e7b5100bf9123d9e7;hb=052e9928511dd77d1d5d489b2a61b75579cc44e3;hpb=d327f3f00c66a79d42855939866047b3e8caa630 diff --git a/ginac/tensor.cpp b/ginac/tensor.cpp index 259af3e4..0a57ae56 100644 --- a/ginac/tensor.cpp +++ b/ginac/tensor.cpp @@ -3,7 +3,7 @@ * Implementation of GiNaC's special tensors. */ /* - * GiNaC Copyright (C) 1999-2008 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2015 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 @@ -20,10 +20,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include -#include -#include - #include "tensor.h" #include "idx.h" #include "indexed.h" @@ -36,6 +32,10 @@ #include "archive.h" #include "utils.h" +#include +#include +#include + namespace GiNaC { GINAC_IMPLEMENT_REGISTERED_CLASS(tensor, basic) @@ -364,13 +364,17 @@ ex tensepsilon::eval_indexed(const basic & i) const if (minkowski) { for (size_t j=1; j(x)) + if (!is_a(x)) { throw(std::runtime_error("indices of epsilon tensor in Minkowski space must be of type varidx")); - if (ex_to(x).is_covariant()) - if (ex_to(x).get_value().is_zero()) + } + if (ex_to(x).is_covariant()) { + if (ex_to(x).get_value().is_zero()) { sign = (pos_sig ? -sign : sign); - else + } + else { sign = (pos_sig ? sign : -sign); + } + } } }