On Thu, Jun 11, 2026 at 06:33:03PM +0800, Qian Yun wrote: > Testing for equality (or inequality) of EPXR is > a core part of Kernel and other places. > > I find that current situation can be improved. > > To test equality, we do not need to compute (x-y) > in full, we can skip the denominator part, skip gcd,
yes > skip potential "algreduc" (rationalizing the denominator), > save a few unnecessary "reduc" calls (only reduce on > necessary algebraic kernels). we definitely need 'reduc'. 'algreduc' is actually about improving efficiency, because _correct_ alternatives are more expensive. > I believe the following change doesn't break anything. AFAICS this is essentially the same as NAG version: x:% = y:% == x =$Rep y (where Rep is doing calculation which you expanded inline) which was changed to current one because the simpler thing is sometimes incorrect. > As a benchmark, for mapleok.input, the memory usage > drop from 13.5GB to 8.5GB, time usage from 14.5s to > 12.2s. > > - Qian > > diff --git a/src/algebra/expr.spad b/src/algebra/expr.spad > index 6b9a11b5..86f94145 100644 > --- a/src/algebra/expr.spad > +++ b/src/algebra/expr.spad > @@ -139,7 +139,8 @@ > simplifyPower(denominator x, n::Integer) > > smaller?(x : %, y : %) == smaller?(x, y)$Rep > - x : % = y : % == (x - y) =$Rep 0$Rep > + x : % = y : % == > + numerator(x)*denominator(y) =$Rep > denominator(x)*numerator(y) > numer x == numer(x)$Rep > denom x == denom(x)$Rep > > -- > You received this message because you are subscribed to the Google Groups > "FriCAS - computer algebra system" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion visit > https://groups.google.com/d/msgid/fricas-devel/54bf5511-7487-41e1-8f1f-169128536449%40gmail.com. -- Waldek Hebisch -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/fricas-devel/aiqfkGuLMdYYlCUd%40fricas.org.
