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

mercurial at gmplib.org mercurial at gmplib.org
Thu Jan 13 10:47:39 CET 2011


details:   /home/hgfiles/gmp/rev/dc99a8c7ed8a
changeset: 13739:dc99a8c7ed8a
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Thu Jan 13 10:20:27 2011 +0100
description:
mpz/mul: Remove redundant size computation

details:   /home/hgfiles/gmp/rev/9159ae2e95e5
changeset: 13740:9159ae2e95e5
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Thu Jan 13 10:30:59 2011 +0100
description:
Space normalization.

details:   /home/hgfiles/gmp/rev/57d200675e2a
changeset: 13741:57d200675e2a
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Thu Jan 13 10:39:15 2011 +0100
description:
Correct title and reference to paper.

details:   /home/hgfiles/gmp/rev/79014e0bd4e6
changeset: 13742:79014e0bd4e6
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Thu Jan 13 10:47:21 2011 +0100
description:
INSTALL: Apply Will Galway's suggestions.

diffstat:

 ChangeLog                  |   4 ++++
 INSTALL                    |   4 ++--
 mpn/generic/matrix22_mul.c |   4 ++--
 mpz/mul.c                  |  40 +++++++++++++++++++---------------------
 4 files changed, 27 insertions(+), 25 deletions(-)

diffs (154 lines):

diff -r 60bb4796a088 -r 79014e0bd4e6 ChangeLog
--- a/ChangeLog	Sat Jan 08 16:02:45 2011 +0100
+++ b/ChangeLog	Thu Jan 13 10:47:21 2011 +0100
@@ -1,3 +1,7 @@
+2011-01-13 Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+	* mpz/mul.c: Remove redundant size computation.
+
 2011-01-08  Torbjorn Granlund  <tege at gmplib.org>
 
 	* tests/devel/try.c (types enum): Add TYPE_MUL_5 and TYPE_MUL_6.
diff -r 60bb4796a088 -r 79014e0bd4e6 INSTALL
--- a/INSTALL	Sat Jan 08 16:02:45 2011 +0100
+++ b/INSTALL	Thu Jan 13 10:47:21 2011 +0100
@@ -27,11 +27,11 @@
 These instructions are only for the impatient.  Others should read the install
 instructions in gmp.info.  Use
 
-	info -f ./gmp.info
+	info -f doc/gmp.info
 
 or in emacs
 
-	C-u C-h i gmp.info
+	C-u C-h i doc/gmp.info
 
 
 Here are some brief instructions on how to install GMP.  First you need to
diff -r 60bb4796a088 -r 79014e0bd4e6 mpn/generic/matrix22_mul.c
--- a/mpn/generic/matrix22_mul.c	Sat Jan 08 16:02:45 2011 +0100
+++ b/mpn/generic/matrix22_mul.c	Thu Jan 13 10:47:21 2011 +0100
@@ -95,8 +95,8 @@
 
   Note: the two matrices above are the same, but s_i and t_i are used
   in the same product, only for i<4, see "A Strassen-like Matrix
-  Multiplication suited for squaring and highest power computation" by
-  M. Bodrato (2008).
+  Multiplication suited for squaring and higher power computation" by
+  M. Bodrato, in Proceedings of ISSAC 2010.
 
     / r0 \   / 1 0  0  0  0  1  0 \ / s0*t0 \
     | r1 | = | 0 0 -1  1 -1  1  0 | | s1*t1 |
diff -r 60bb4796a088 -r 79014e0bd4e6 mpz/mul.c
--- a/mpz/mul.c	Sat Jan 08 16:02:45 2011 +0100
+++ b/mpz/mul.c	Thu Jan 13 10:47:21 2011 +0100
@@ -37,8 +37,8 @@
   mp_limb_t cy_limb;
   TMP_DECL;
 
-  usize = SIZ(u);
-  vsize = SIZ(v);
+  usize = SIZ (u);
+  vsize = SIZ (v);
   sign_product = usize ^ vsize;
   usize = ABS (usize);
   vsize = ABS (vsize);
@@ -51,7 +51,7 @@
 
   if (vsize == 0)
     {
-      SIZ(w) = 0;
+      SIZ (w) = 0;
       return;
     }
 
@@ -59,53 +59,53 @@
   if (vsize <= 2)
     {
       MPZ_REALLOC (w, usize+vsize);
-      wp = PTR(w);
+      wp = PTR (w);
       if (vsize == 1)
-	cy_limb = mpn_mul_1 (wp, PTR(u), usize, PTR(v)[0]);
+	cy_limb = mpn_mul_1 (wp, PTR (u), usize, PTR (v)[0]);
       else
 	{
-	  cy_limb = mpn_mul_2 (wp, PTR(u), usize, PTR(v));
+	  cy_limb = mpn_mul_2 (wp, PTR (u), usize, PTR (v));
 	  usize++;
 	}
       wp[usize] = cy_limb;
       usize += (cy_limb != 0);
-      SIZ(w) = (sign_product >= 0 ? usize : -usize);
+      SIZ (w) = (sign_product >= 0 ? usize : -usize);
       return;
     }
 #else
   if (vsize == 1)
     {
       MPZ_REALLOC (w, usize+1);
-      wp = PTR(w);
-      cy_limb = mpn_mul_1 (wp, PTR(u), usize, PTR(v)[0]);
+      wp = PTR (w);
+      cy_limb = mpn_mul_1 (wp, PTR (u), usize, PTR (v)[0]);
       wp[usize] = cy_limb;
       usize += (cy_limb != 0);
-      SIZ(w) = (sign_product >= 0 ? usize : -usize);
+      SIZ (w) = (sign_product >= 0 ? usize : -usize);
       return;
     }
 #endif
 
   TMP_MARK;
   free_me = NULL;
-  up = PTR(u);
-  vp = PTR(v);
-  wp = PTR(w);
+  up = PTR (u);
+  vp = PTR (v);
+  wp = PTR (w);
 
   /* Ensure W has space enough to store the result.  */
   wsize = usize + vsize;
-  if (ALLOC(w) < wsize)
+  if (ALLOC (w) < wsize)
     {
       if (wp == up || wp == vp)
 	{
 	  free_me = wp;
-	  free_me_size = ALLOC(w);
+	  free_me_size = ALLOC (w);
 	}
       else
-	(*__gmp_free_func) (wp, ALLOC(w) * BYTES_PER_MP_LIMB);
+	(*__gmp_free_func) (wp, ALLOC (w) * BYTES_PER_MP_LIMB);
 
-      ALLOC(w) = wsize;
+      ALLOC (w) = wsize;
       wp = (mp_ptr) (*__gmp_allocate_func) (wsize * BYTES_PER_MP_LIMB);
-      PTR(w) = wp;
+      PTR (w) = wp;
     }
   else
     {
@@ -132,18 +132,16 @@
   if (up == vp)
     {
       mpn_sqr (wp, up, usize);
-      wsize = usize + vsize;
       cy_limb = wp[wsize - 1];
     }
   else
     {
       cy_limb = mpn_mul (wp, up, usize, vp, vsize);
-      wsize = usize + vsize;
     }
 
   wsize -= cy_limb == 0;
 
-  SIZ(w) = sign_product < 0 ? -wsize : wsize;
+  SIZ (w) = sign_product < 0 ? -wsize : wsize;
   if (free_me != NULL)
     (*__gmp_free_func) (free_me, free_me_size * BYTES_PER_MP_LIMB);
   TMP_FREE;


More information about the gmp-commit mailing list