[GiNaC-devel] Bug(?) in reposition_dummy_indices: test case and
patch
Sheplyakov Alexei
varg at theor.jinr.ru
Fri Oct 6 14:04:55 CEST 2006
Hello,
On Fri, Sep 08, 2006 at 06:02:13PM +0200, Chris Dams wrote:
> > What about modifying the canonicalization code in symmetry.cpp, then? We
> > could at first decide the canonical form based only on the values and
> > dimensions of the indices. Not on their variance. If that does not give a
> > prefered ordering we would order them the same way as is done now.
> > Besides that, we should reject a toggling of indices in reposition_dummy
> > indices if it results in an expression with reordered indices. Does this
> > sound any better?
>
> I now patched the function reposition_dummy_indices to fix this. The idea
> is that the problem Alexei pointed out can only occur if there are
> varidxes involved in a cyclic symmetry.
[snipped]
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).
What your patch does is work-around for one of such (non-trivial eval)
cases, but I think the code is still terribly broken.
Best regards,
Alexei
--
All science is either physics or stamp collecting.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: Digital signature
Url : http://www.cebix.net/pipermail/ginac-devel/attachments/20061006/8b27c799/attachment.pgp
More information about the GiNaC-devel
mailing list