[Gmp-commit] /home/hgfiles/gmp: 2 new changesets

mercurial at gmplib.org mercurial at gmplib.org
Sun Dec 27 18:37:01 CET 2009


details:   /home/hgfiles/gmp/rev/dd1a1202186d
changeset: 13238:dd1a1202186d
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sun Dec 27 18:17:12 2009 +0100
description:
New ratio for mullo.

details:   /home/hgfiles/gmp/rev/f5b773f89d5b
changeset: 13239:f5b773f89d5b
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Sun Dec 27 18:36:43 2009 +0100
description:
Use toom6h and toom8h for almost balanced multiplications.

diffstat:

 ChangeLog             |   6 ++++++
 mpn/generic/mul.c     |  17 +++++++++++++++--
 mpn/generic/mullo_n.c |   6 +-----
 3 files changed, 22 insertions(+), 7 deletions(-)

diffs (61 lines):

diff -r 26dff66a8255 -r f5b773f89d5b ChangeLog
--- a/ChangeLog	Sun Dec 27 15:59:04 2009 +0100
+++ b/ChangeLog	Sun Dec 27 18:36:43 2009 +0100
@@ -1,3 +1,9 @@
+2009-12-27  Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+	* mpn/generic/mul.c: Use toom6h and toom8h for almost balanced.
+
+	* mpn/generic/mullo_n.c (mpn_dc_mullo_n): New ratio, to be used in Toom-8 range.
+
 2009-12-27  Torbjorn Granlund  <tege at gmplib.org>
 
 	* mpn/*/gmp-mparam.h: Fix incorrect MOD_1U_TO_MOD_1_1_THRESHOLD 0
diff -r 26dff66a8255 -r f5b773f89d5b mpn/generic/mul.c
--- a/mpn/generic/mul.c	Sun Dec 27 15:59:04 2009 +0100
+++ b/mpn/generic/mul.c	Sun Dec 27 18:36:43 2009 +0100
@@ -318,8 +318,21 @@
 	  mp_ptr scratch;
 	  TMP_DECL; TMP_MARK;
 
-	  scratch = TMP_ALLOC_LIMBS (mpn_toom44_mul_itch (un, vn));
-	  mpn_toom44_mul (prodp, up, un, vp, vn, scratch);
+	  if (BELOW_THRESHOLD (vn, MUL_TOOM6H_THRESHOLD))
+	    {
+	      scratch = TMP_ALLOC_LIMBS (mpn_toom44_mul_itch (un, vn));
+	      mpn_toom44_mul (prodp, up, un, vp, vn, scratch);
+	    }
+	  else if (BELOW_THRESHOLD (vn, MUL_TOOM8H_THRESHOLD))
+	    {
+	      scratch = TMP_ALLOC_LIMBS (mpn_toom6h_mul_itch (un, vn));
+	      mpn_toom6h_mul (prodp, up, un, vp, vn, scratch);
+	    }
+	  else
+	    {
+	      scratch = TMP_ALLOC_LIMBS (mpn_toom8h_mul_itch (un, vn));
+	      mpn_toom8h_mul (prodp, up, un, vp, vn, scratch);
+	    }
 	  TMP_FREE;
 	}
     }
diff -r 26dff66a8255 -r f5b773f89d5b mpn/generic/mullo_n.c
--- a/mpn/generic/mullo_n.c	Sun Dec 27 15:59:04 2009 +0100
+++ b/mpn/generic/mullo_n.c	Sun Dec 27 18:36:43 2009 +0100
@@ -155,16 +155,12 @@
     n1 = n * 11 / (size_t) 36;	/* n1 ~= n*(1-.694...) */
   else if (BELOW_THRESHOLD (n, MUL_TOOM44_THRESHOLD*40/(40-9)))
     n1 = n * 9 / (size_t) 40;	/* n1 ~= n*(1-.775...) */
-#if 1
-  else
-    n1 = n * 7 / (size_t) 39;	/* n1 ~= n*(1-.821...) */
-#else /* Enable this branch after debugging high-degree-Toom-related crashes. */
   else if (BELOW_THRESHOLD (n, MUL_TOOM8H_THRESHOLD*10/9))
     n1 = n * 7 / (size_t) 39;	/* n1 ~= n*(1-.821...) */
   /* n1 = n * 4 / (size_t) 31;	// n1 ~= n*(1-.871...) [TOOM66] */
   else
     n1 = n / (size_t) 10;		/* n1 ~= n*(1-.899...) [TOOM88] */
-#endif
+
   n2 = n - n1;
 
   /* Split as x = x1 2^(n2 GMP_NUMB_BITS) + x0,


More information about the gmp-commit mailing list