[GiNaC-devel] Bug(?) in reposition_dummy_indices: test case and patch
Chris Dams
Chris.Dams at mi.infn.it
Tue Oct 10 13:16:21 CEST 2006
Dear Alexei,
On Fri, 6 Oct 2006, Sheplyakov Alexei wrote:
> I don't think your analysis is completely correct. The problem is that
>
> e = e.subs(something)
>
> calls e.eval(), and eval can change the original expression so that
> iterators become invalid. Actually, after the evaluation expression can
> be *anything*, even not necessarily indexed. For example, the expression
> in question could evaluate to zero (if someone implements derived class
> such that for some combination of indices the thing evaluates to zero).
It is true that an evaluation function can be written such that this goes
wrong. However, I was assuming that evaluation functions are doing things
to expressions that make sense. Assuming that the metric is invertible,
it is not possible that A~mu~nu~sigma~tau is nonzero and that
A.mu~nu~sigma~tau is zero. Hence, an evaluation function that turns one of
them into zero should do this to the other as well. Do you know of any
evaluation that does make sense where we would encounter this kind of
problem? I thought about this, but came to the conclusion that this
probably cannot happen. On the other hand, as a matter of principle you
are right that it is best to assume as little about the rest of the code
as possbile. For this reason I would accept a patch that would do the
substitutions as they are currently but does not cause eval to be called.
Best wishes,
Chris
More information about the GiNaC-devel
mailing list