* Implementation of GiNaC's special tensors. */
/*
- * GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2002 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
} else if (other->return_type() == return_types::commutative) {
-#if 0
- // This handles eps.i.j.k * p.j * p.k = 0
- // Maybe something like this should go to simplify_indexed() because
- // such relations are true for any antisymmetric tensors...
+#if 1
+ // This handles eps.i.j.k * p.j * p.k = 0 and related cases.
+ // Actually, simplify_indexed() can handle most of them on its own
+ // but one specific case that is not covered there is
+ // eps~mu.nu~i~j * p.mu * p~nu
+ // because of the difference in variance in the dummy indices mu
+ // and nu. Eventually, simplify_indexed() should be extended to
+ // handle this case, and this hack removed.
exvector c;
// Handle all indices of the epsilon tensor
{
if (!is_ex_of_type(i1, varidx) || !is_ex_of_type(i2, varidx))
throw(std::invalid_argument("indices of metric tensor must be of type varidx"));
+ 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 metric tensor must have the same dimension"));
return indexed(tensmetric(), sy_symm(), i1, i2);
}
{
if (!is_ex_of_type(i1, varidx) || !is_ex_of_type(i2, varidx))
throw(std::invalid_argument("indices of metric tensor must be of type varidx"));
+ 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 metric tensor must have the same dimension"));
return indexed(minkmetric(pos_sig), sy_symm(), i1, i2);
}