[GiNaC-devel] [PATCH] {add, power}::eval(): convert terms into primitive polynomials when possible.

Jens Vollinga vollinga at physik.uni-wuppertal.de
Thu Aug 2 11:04:21 CEST 2007


Hi Alexei and Richy,

Richard B. Kreckel schrieb:
> Alexei Sheplyakov wrote:
>> The following transformations are done automagically now:
>> (-x+y)*(x-y) -> -(x-y)^2
>> (3*x+y)/(6*x+2*y)^2 -> 1/4*(y+3*x)^(-1)
>>
>> Please note: exam_series13() from check/exam_pseries.cpp fails due to
>> this patch, because the expression 1/x*(-(1+x)/(1-x)) + (1+x)/x/(1-x)
>> gets evaluated to zero.
> 
> This patch appears to come with a slight performance hit. On my machine, 
> 14x14 Vandermonde matrix determinants degrades from 19s to 32s, 
> Lewis-Wester test O1 from 7.5s to 11s, and Lewis-Wester test A from 
> 0.055s to 0.22s. (I'm seriously surprised by the latter since it only 
> involves integers, but it's reproducible.)
> 
> Looking at the code it appears to me like mul::eval recurses now. 
> Wouldn't it be faster to collect the coefficients in one sweep? Well, I 
> recognize that most terms will be trivial in the following recursions, 
> but still.
> 
> Also, you write that "in some very unlucky event it can even loop 
> forever". I don't quite understand. Do you have an example for this?

something new here? I kind of feel like doing a release soon, 1.3.8 and 
also maybe then a 1.4, but this seems to be a sort of issue to be solved 
first.

Regards,
Jens


More information about the GiNaC-devel mailing list