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,
skip potential "algreduc" (rationalizing the denominator),
save a few unnecessary "reduc" calls (only reduce on
necessary algebraic kernels).

I believe the following change doesn't break anything.

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.

Reply via email to