[GiNaC-list] Ordering of expressions
varg at metalica.kh.ua
Sun Aug 9 12:22:18 CEST 2009
On Sat, Aug 08, 2009 at 07:28:49PM +0200, Luigi Capozza wrote:
> I have the following issue with the canonicalization of
> expressions. If I run many times the same program without changing
> anything, I get the output for the same expression ordered in
> different ways.
This behavior is documented in the manual (section 5.7.2, titled as 'Expanding
and collecting'): "Again, since the canonical form in GiNaC is not easy to
guess you should be prepared to see different orderings of terms in such
> With more complicated expressions also the run time can vary from
> execution to execution up to a factor of 2 or more.
What exactly is a `run time'? CPU time? Wall clock time? Something else?
> Is this normal or am I doing something wrong? I saw that the hash
> value is calculated in a fairly sophisticated manner but is it eventually
> possible to set it by hand?
No, this is an implementation detail, and users are not supposed to fiddle
with it (the only exception is implementing calchash() method in user defined
@developers: I guess we should add this question to the FAQ, shouldn't we?
More information about the GiNaC-list