
-------- Original Message -------- Subject: Re: Automatic evaluation/simplification Date: Wed, 20 Nov 2002 10:07:32 +0100 From: KRECKEL Richard NGLT Richard.Kreckel@framatome-anp.com To: 'bagnara@cs.unipr.it' bagnara@cs.unipr.it
Dear Roberto,
Yes, the FAQ says it is completely automatic. However, is there a way to switch it off?
Forgive me for the very imprecise question. The situation is as follows: we have some monster expressions where we need to substitute a few thousands of symbol's occurrences with something else. We did that by implementing our own recursive tree traversal. However, we estimate that more than 80% of the time is spent in attempted simplifications by GiNaC (which we know are deemed to fail). Is there any way to implement this substitution process so as to avoid this big overhead?
If you really do think that the "anonymous evaluation"(*) process in GiNaC is your bottleneck you could try arranging your "monster expressions" manually in an exvector (i.e. std::vectorGiNaC::ex) or an epvector (i.e. std::vectorGiNaC::expair) and then use the GiNaC::add ctor from those structures.
Regards -richy.
(*) Definition: We call "evaluation" a top-down tree-traversal and -rearrangement algorithm. "Anonymous" evaluation is the one you don't call explicitly, as opposed to a "named" evaluation which you call by hand, e.g. evalf(). "Simplification" is more general, it does not have to go top-down (or bottom-up, this doesn't really matter, it's just preorder vs. postorder traversal) and can thus be regarded as non-local on the expression-tree's nodes. This is my own definition of the two concepts I came up with about two years ago because the literature seems to be utterly confused and I was unable to see a consensus. This definition has turned out to be useful and well-defined. GiNaC provides evaluation, mostly. The function objects transforming trigonometric functions mentioned in the FAQ are simplifications, according to this definition. I will soon add some clarification about the two concepts in the documentation.
PS: Sorry for the late answer, I am stuck in Erlangen for a while and can only view the GiNaC lists via the web-interface. Email sent to my old address will not be read until x-mas, so please reply to this new address.