complex conjugation

chrisd at chrisd at
Wed Dec 10 19:24:07 CET 2003


On Wed, 10 Dec 2003, Christian Bauer wrote:

> I have read it but I'm not satisfied with that patch. Blindly re-expanding
> results is prohibitively expensive in terms of efficiency. There has to be
> a more clever way of doing this, and I believe I have found it for
> power::expand(). I'm currently trying to implement it in a similar way
> for mul::expand().

Hmmm, why is that? Building the expanded expression that is a sum of
products must in time at least be proportional to the total number of
factors in all the products. Checking whether anything can be further
expanded should also be take proportional to that time (with a smaller
factor), because the factors that occur in this sum of products should
have set the flag that indicates that it is already expanded. Perhaps you
could gain a little by using that knowledge and skip the call to
mul::expandchildren and furthermore skip putting factors in the the
non_adds epvector, as is done in mul::expand, after you check that none of
the factors contains an add. The latter optimization could be done always,
I suppose. But anyways, I do not see big losses nor big gains here.


More information about the GiNaC-devel mailing list