https://github.com/oldk1331/fricas/commit/88a8ed4dd84ec1b6f15c35fff765031441bdfa61.patch

Because of the list of factors are already sorted,
we can 'merge' them during multiplication, instead
of going through the object creation process again.

diff --git a/src/algebra/fr.spad b/src/algebra/fr.spad
index 54a021c0..9f1a9978 100644
--- a/src/algebra/fr.spad
+++ b/src/algebra/fr.spad
@@ -235,11 +235,24 @@
           _*/[convert(f.factor)@DoubleFloat ^ f.exponent for f in factorList x]

     u : % * v : % ==
-      zero? u or zero? v => 0
-      (u = 1) => v
-      (v = 1) => u
-      mkFF(unit u * unit v,
-          SimplifyFactorization concat(factorList u, copy factorList v))
+        zero? u or zero? v => u
+        one? u => v
+        one? v => u
+        lu := factorList u; lv := factorList v
+        res : List FF := []
+        while not empty? lu and not empty? lv repeat
+            u1 := first lu; v1 := first lv
+            u1.factor = v1.factor =>
+                res := concat([stricterFlag(u1.flag, v1.flag), _
+                               u1.factor, u1.exponent + v1.exponent], res)
+                lu := rest lu; lv := rest lv
+            LispLessP(u1, v1) =>
+                res := concat(u1, res)
+                lu := rest lu
+            res := concat(v1, res)
+            lv := rest lv
+        res := concat!(reverse! res, if empty? lu then lv else lu)
+        mkFF(unit u * unit v, res)

     u : % ^ n : NonNegativeInteger ==
       n = 0 => 1

-- 
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to