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

mercurial at gmplib.org mercurial at gmplib.org
Sun Apr 18 21:52:15 CEST 2010


details:   /home/hgfiles/gmp/rev/fee58157a562
changeset: 13535:fee58157a562
user:      Niels M?ller <nisse at lysator.liu.se>
date:      Wed Apr 14 21:38:58 2010 +0200
description:
Renamed mpn_hgcd_matrix1_inverse_vector to mpn_matrix22_mul1_inverse_vector, and moved to a separate file.

details:   /home/hgfiles/gmp/rev/08ef31c0390d
changeset: 13536:08ef31c0390d
user:      Niels M?ller <nisse at lysator.liu.se>
date:      Wed Apr 14 21:49:00 2010 +0200
description:
Fixed spelling in comment.

diffstat:

 ChangeLog                                  |  19 ++++++++++
 configure.in                               |   3 +-
 gmp-impl.h                                 |   4 +-
 mpn/Makefile.am                            |   2 +-
 mpn/generic/gcd_lehmer.c                   |   2 +-
 mpn/generic/gcdext_lehmer.c                |   2 +-
 mpn/generic/hgcd.c                         |   2 +-
 mpn/generic/hgcd2.c                        |  28 ---------------
 mpn/generic/matrix22_mul1_inverse_vector.c |  54 ++++++++++++++++++++++++++++++
 tests/mpz/t-jac.c                          |   4 +-
 10 files changed, 83 insertions(+), 37 deletions(-)

diffs (208 lines):

diff -r da5903b6e386 -r 08ef31c0390d ChangeLog
--- a/ChangeLog	Fri Mar 26 10:23:46 2010 +0100
+++ b/ChangeLog	Wed Apr 14 21:49:00 2010 +0200
@@ -1,3 +1,22 @@
+2010-04-14  Niels Möller  <nisse at lysator.liu.se>
+
+	* configure.in (gmp_mpn_functions): Added
+	matrix22_mul1_inverse_vector.
+	* mpn/Makefile.am (nodist_EXTRA_libmpn_la_SOURCES): Added
+	matrix22_mul1_inverse_vector.c.
+
+	* gmp-impl.h (mpn_matrix22_mul1_inverse_vector): Updated for
+	rename of mpn_matrix22_mul1_inverse_vector.
+	* mpn/generic/gcd_lehmer.c (mpn_gcd_lehmer_n): Likewise.
+	* mpn/generic/gcdext_lehmer.c (mpn_gcdext_lehmer_n): Likewise.
+	* mpn/generic/hgcd.c (hgcd_step): Likewise.
+
+	* mpn/generic/matrix22_mul1_inverse_vector.c
+	(mpn_matrix22_mul1_inverse_vector): New file, function moved and
+	renamed...
+	* mpn/generic/hgcd2.c (mpn_hgcd_mul_matrix1_inverse_vector):
+	...from here.
+	
 2010-03-25  Torbjorn Granlund  <tege at gmplib.org>
 
 	* mpn/ia64/add_n_sub_n.asm: New file.
diff -r da5903b6e386 -r 08ef31c0390d configure.in
--- a/configure.in	Fri Mar 26 10:23:46 2010 +0100
+++ b/configure.in	Wed Apr 14 21:49:00 2010 +0200
@@ -2516,7 +2516,8 @@
   gcd_1 gcd gcdext_1 gcdext gcd_lehmer gcd_subdiv_step			   \
   gcdext_lehmer gcdext_subdiv_step					   \
   div_q tdiv_qr jacbase get_d						   \
-  matrix22_mul hgcd2 hgcd mullo_n mullo_basecase			   \
+  matrix22_mul matrix22_mul1_inverse_vector				   \
+  hgcd2 hgcd mullo_n mullo_basecase					   \
   toom22_mul toom32_mul toom42_mul toom52_mul toom62_mul		   \
   toom33_mul toom43_mul toom53_mul toom63_mul				   \
   toom44_mul								   \
diff -r da5903b6e386 -r 08ef31c0390d gmp-impl.h
--- a/gmp-impl.h	Fri Mar 26 10:23:46 2010 +0100
+++ b/gmp-impl.h	Wed Apr 14 21:49:00 2010 +0200
@@ -3764,8 +3764,8 @@
 #define mpn_hgcd_mul_matrix1_vector __MPN (hgcd_mul_matrix1_vector)
 __GMP_DECLSPEC mp_size_t mpn_hgcd_mul_matrix1_vector __GMP_PROTO ((const struct hgcd_matrix1 *, mp_ptr, mp_srcptr, mp_ptr, mp_size_t));
 
-#define mpn_hgcd_mul_matrix1_inverse_vector __MPN (hgcd_mul_matrix1_inverse_vector)
-__GMP_DECLSPEC mp_size_t mpn_hgcd_mul_matrix1_inverse_vector __GMP_PROTO ((const struct hgcd_matrix1 *, mp_ptr, mp_srcptr, mp_ptr, mp_size_t));
+#define mpn_matrix22_mul1_inverse_vector __MPN (matrix22_mul1_inverse_vector)
+__GMP_DECLSPEC mp_size_t mpn_matrix22_mul1_inverse_vector __GMP_PROTO ((const struct hgcd_matrix1 *, mp_ptr, mp_srcptr, mp_ptr, mp_size_t));
 
 struct hgcd_matrix
 {
diff -r da5903b6e386 -r 08ef31c0390d mpn/Makefile.am
--- a/mpn/Makefile.am	Fri Mar 26 10:23:46 2010 +0100
+++ b/mpn/Makefile.am	Wed Apr 14 21:49:00 2010 +0200
@@ -45,7 +45,7 @@
   gcd_1.c gcdext.c get_d.c get_str.c					    \
   hamdist.c hgcd2.c hgcd.c invert_limb.c				    \
   ior_n.c iorn_n.c jacbase.c lshift.c					    \
-  matrix22_mul.c mod_1.c mod_34lsub1.c mode1o.c				    \
+  matrix22_mul.c matrix22_mul1_inverse_vector.c mod_1.c mod_34lsub1.c mode1o.c  \
   mod_1_1.c mod_1_2.c mod_1_3.c mod_1_4.c				    \
   mul.c mul_1.c mul_2.c mul_3.c mul_4.c mul_fft.c mul_n.c mul_basecase.c    \
   nussbaumer_mul.c							    \
diff -r da5903b6e386 -r 08ef31c0390d mpn/generic/gcd_lehmer.c
--- a/mpn/generic/gcd_lehmer.c	Fri Mar 26 10:23:46 2010 +0100
+++ b/mpn/generic/gcd_lehmer.c	Wed Apr 14 21:49:00 2010 +0200
@@ -116,7 +116,7 @@
       /* Try an mpn_nhgcd2 step */
       if (mpn_hgcd2 (ah, al, bh, bl, &M))
 	{
-	  n = mpn_hgcd_mul_matrix1_inverse_vector (&M, tp, ap, bp, n);
+	  n = mpn_matrix22_mul1_inverse_vector (&M, tp, ap, bp, n);
 	  MP_PTR_SWAP (ap, tp);
 	}
       else
diff -r da5903b6e386 -r 08ef31c0390d mpn/generic/gcdext_lehmer.c
--- a/mpn/generic/gcdext_lehmer.c	Fri Mar 26 10:23:46 2010 +0100
+++ b/mpn/generic/gcdext_lehmer.c	Wed Apr 14 21:49:00 2010 +0200
@@ -96,7 +96,7 @@
       /* Try an mpn_nhgcd2 step */
       if (mpn_hgcd2 (ah, al, bh, bl, &M))
 	{
-	  n = mpn_hgcd_mul_matrix1_inverse_vector (&M, tp, ap, bp, n);
+	  n = mpn_matrix22_mul1_inverse_vector (&M, tp, ap, bp, n);
 	  MP_PTR_SWAP (ap, tp);
 	  un = mpn_hgcd_mul_matrix1_vector(&M, u2, u0, u1, un);
 	  MP_PTR_SWAP (u0, u2);
diff -r da5903b6e386 -r 08ef31c0390d mpn/generic/hgcd.c
--- a/mpn/generic/hgcd.c	Fri Mar 26 10:23:46 2010 +0100
+++ b/mpn/generic/hgcd.c	Wed Apr 14 21:49:00 2010 +0200
@@ -214,7 +214,7 @@
       /* Can't swap inputs, so we need to copy. */
       MPN_COPY (tp, ap, n);
       /* Multiply M1^{-1} (a;b) */
-      return mpn_hgcd_mul_matrix1_inverse_vector (&M1, ap, tp, bp, n);
+      return mpn_matrix22_mul1_inverse_vector (&M1, ap, tp, bp, n);
     }
 
  subtract:
diff -r da5903b6e386 -r 08ef31c0390d mpn/generic/hgcd2.c
--- a/mpn/generic/hgcd2.c	Fri Mar 26 10:23:46 2010 +0100
+++ b/mpn/generic/hgcd2.c	Wed Apr 14 21:49:00 2010 +0200
@@ -439,31 +439,3 @@
   n += (ah | bh) > 0;
   return n;
 }
-
-/* Sets (r;b) = M^{-1}(a;b), with M^{-1} = (u11, -u01; -u10, u00) from
-   the left. Uses three buffers, to avoid a copy. */
-mp_size_t
-mpn_hgcd_mul_matrix1_inverse_vector (const struct hgcd_matrix1 *M,
-				     mp_ptr rp, mp_srcptr ap, mp_ptr bp, mp_size_t n)
-{
-  mp_limb_t h0, h1;
-
-  /* Compute (r;b) <-- (u11 a - u01 b; -u10 a + u00 b) as
-
-     r  = u11 * a
-     r -= u01 * b
-     b *= u00
-     b -= u10 * a
-  */
-
-  h0 =    mpn_mul_1 (rp, ap, n, M->u[1][1]);
-  h1 = mpn_submul_1 (rp, bp, n, M->u[0][1]);
-  ASSERT (h0 == h1);
-
-  h0 =    mpn_mul_1 (bp, bp, n, M->u[0][0]);
-  h1 = mpn_submul_1 (bp, ap, n, M->u[1][0]);
-  ASSERT (h0 == h1);
-
-  n -= (rp[n-1] | bp[n-1]) == 0;
-  return n;
-}
diff -r da5903b6e386 -r 08ef31c0390d mpn/generic/matrix22_mul1_inverse_vector.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpn/generic/matrix22_mul1_inverse_vector.c	Wed Apr 14 21:49:00 2010 +0200
@@ -0,0 +1,54 @@
+/* matrix22_mul1_inverse_vector.c
+
+   THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH MUTABLE INTERFACES.  IT IS ONLY
+   SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES.  IN FACT, IT IS ALMOST
+   GUARANTEED THAT THEY'LL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
+
+Copyright 2008, 2010 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 3 of the License, or (at your
+option) any later version.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.  */
+
+#include "gmp.h"
+#include "gmp-impl.h"
+#include "longlong.h"
+
+/* Sets (r;b) = M^{-1}(a;b), with M^{-1} = (u11, -u01; -u10, u00) from
+   the left. Uses three buffers, to avoid a copy. */
+mp_size_t
+mpn_matrix22_mul1_inverse_vector (const struct hgcd_matrix1 *M,
+				  mp_ptr rp, mp_srcptr ap, mp_ptr bp, mp_size_t n)
+{
+  mp_limb_t h0, h1;
+
+  /* Compute (r;b) <-- (u11 a - u01 b; -u10 a + u00 b) as
+
+     r  = u11 * a
+     r -= u01 * b
+     b *= u00
+     b -= u10 * a
+  */
+
+  h0 =    mpn_mul_1 (rp, ap, n, M->u[1][1]);
+  h1 = mpn_submul_1 (rp, bp, n, M->u[0][1]);
+  ASSERT (h0 == h1);
+
+  h0 =    mpn_mul_1 (bp, bp, n, M->u[0][0]);
+  h1 = mpn_submul_1 (bp, ap, n, M->u[1][0]);
+  ASSERT (h0 == h1);
+
+  n -= (rp[n-1] | bp[n-1]) == 0;
+  return n;
+}
diff -r da5903b6e386 -r 08ef31c0390d tests/mpz/t-jac.c
--- a/tests/mpz/t-jac.c	Fri Mar 26 10:23:46 2010 +0100
+++ b/tests/mpz/t-jac.c	Wed Apr 14 21:49:00 2010 +0200
@@ -829,8 +829,8 @@
 #define NUMBER_OF_PRIMES 167
 
 /* Similar to mpz_nextprime, finds the first (odd) prime of the form n
-   + k * step, with k >= 1. If n and step has a cmmon factor, it never
-   temrinates... */
+   + k * step, with k >= 1. If n and step has a common factor, it never
+   terminates... */
 static void
 mpz_nextprime_step (mpz_ptr p, mpz_srcptr n, mpz_srcptr step_in)
 {


More information about the gmp-commit mailing list