collect() eats fractions

Richard B. Kreckel kreckel at thep.physik.uni-mainz.de
Sat Apr 14 18:23:39 CEST 2001


Hi,

On Sat, 14 Apr 2001, Pearu Peterson wrote:
> Sorry to bother you again but my previous fix didn't work.
> Below is given a working version. Any ideas how to optimize it?

Nope.  There are some functions of this sort where an algorithm works only
in a subdomain and we correct the final result in a similar manner to
account for this.  If I remember correctly another example is Yun's
algorithm which works only in the monic case.  So we multiply with the
polynomial quotient of the result of Yun's algorithm and its original
argument before returning the final result in sqrfree().  I would consider
this approach valid.  Thank you for the patch, I've added it to the pile
of things to commit later this day.

> Btw, I have noticed that you use frequently
> 
>    for (int n=this->ldegree(s); n<=this->degree(s); n++)
> 
> instead of more efficient
> 
>    for (int n=this->ldegree(s), m=this->degree(s); n<=m; ++n)
> 
> that saves repeated calling of the degree() method.

Indeed, it does.  But where else besides in basic::collect() do you see
occurences of this?

Regards
     -richy.
-- 
Richard Kreckel
<Richard.Kreckel at Uni-Mainz.DE>
<http://wwwthep.physik.uni-mainz.de/~kreckel/>





More information about the GiNaC-devel mailing list