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

mercurial at gmplib.org mercurial at gmplib.org
Thu Feb 25 18:49:09 CET 2010


details:   /home/hgfiles/gmp/rev/14277966f72b
changeset: 13442:14277966f72b
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Thu Feb 25 18:40:00 2010 +0100
description:
Retune.

details:   /home/hgfiles/gmp/rev/f2f9d5b879ff
changeset: 13443:f2f9d5b879ff
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Thu Feb 25 18:41:40 2010 +0100
description:
Retune.

details:   /home/hgfiles/gmp/rev/219b74efa7ce
changeset: 13444:219b74efa7ce
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Thu Feb 25 18:47:10 2010 +0100
description:
Trivial merge.

details:   /home/hgfiles/gmp/rev/accaa23768f7
changeset: 13445:accaa23768f7
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Thu Feb 25 18:49:00 2010 +0100
description:
Decrease tests' counts.

diffstat:

 ChangeLog                            |  13 +++++++
 mpn/powerpc64/mode64/p4/gmp-mparam.h |  16 ++++----
 mpn/x86_64/gmp-mparam.h              |   2 +-
 tests/devel/try.c                    |  59 ++++++++++++++++++++++++++++++++++-
 tests/mpn/t-toom6h.c                 |   2 +
 tests/mpn/t-toom8h.c                 |   2 +
 tests/refmpz.c                       |  34 +++++++++++++++++++-
 7 files changed, 114 insertions(+), 14 deletions(-)

diffs (256 lines):

diff -r d66997641b54 -r accaa23768f7 ChangeLog
--- a/ChangeLog	Thu Feb 25 16:08:31 2010 +0100
+++ b/ChangeLog	Thu Feb 25 18:49:00 2010 +0100
@@ -1,5 +1,18 @@
+2010-02-25  Niels Möller  <nisse at lysator.liu.se>
+
+	* tests/devel/try.c (param_init): Support mpz_legendre.
+	(choice_array): Added mpz_kronecker (apparently forgotten) and
+	mpz_legendre.
+	(call): Added TYPE_MPZ_LEGENDRE.
+	(try_one): Added support for DATA_SRC1_ODD_PRIME.
+
+	* tests/refmpz.c (refmpz_legendre): Rewrote using powm.
+
 2010-02-25  Torbjorn Granlund  <tege at gmplib.org>
 
+	* tests/mpn/t-toom6h.c (COUNT): Define.
+	* tests/mpn/t-toom8h.c (COUNT): Define.
+
 	* tests/mpn/t-div.c: Cast a switch index to placate HP's cc.
 	* tests/mpn/t-bdiv.c: Likewise.
 
diff -r d66997641b54 -r accaa23768f7 mpn/powerpc64/mode64/p4/gmp-mparam.h
--- a/mpn/powerpc64/mode64/p4/gmp-mparam.h	Thu Feb 25 16:08:31 2010 +0100
+++ b/mpn/powerpc64/mode64/p4/gmp-mparam.h	Thu Feb 25 18:49:00 2010 +0100
@@ -43,7 +43,7 @@
 #define MUL_TOOM42_TO_TOOM53_THRESHOLD      97
 #define MUL_TOOM42_TO_TOOM63_THRESHOLD      97
 
-#define SQR_BASECASE_THRESHOLD               5
+#define SQR_BASECASE_THRESHOLD              10
 #define SQR_TOOM2_THRESHOLD                 36
 #define SQR_TOOM3_THRESHOLD                 61
 #define SQR_TOOM4_THRESHOLD                154
@@ -169,17 +169,17 @@
 #define SQR_FFT_THRESHOLD                 2752
 
 #define MULLO_BASECASE_THRESHOLD             5
-#define MULLO_DC_THRESHOLD                  34
-#define MULLO_MUL_N_THRESHOLD            14281
+#define MULLO_DC_THRESHOLD                  44
+#define MULLO_MUL_N_THRESHOLD             6440
 
 #define DC_DIV_QR_THRESHOLD                 30
 #define DC_DIVAPPR_Q_THRESHOLD             103
 #define DC_BDIV_QR_THRESHOLD                48
 #define DC_BDIV_Q_THRESHOLD                120
 
-#define INV_MULMOD_BNM1_THRESHOLD           30
-#define INV_NEWTON_THRESHOLD               129
-#define INV_APPR_THRESHOLD                 109
+#define INV_MULMOD_BNM1_THRESHOLD           42
+#define INV_NEWTON_THRESHOLD               117
+#define INV_APPR_THRESHOLD                 117
 
 #define BINV_NEWTON_THRESHOLD              204
 #define REDC_1_TO_REDC_N_THRESHOLD          55
@@ -190,7 +190,7 @@
 #define MU_BDIV_QR_THRESHOLD               889
 #define MU_BDIV_Q_THRESHOLD               1078
 
-#define MATRIX22_STRASSEN_THRESHOLD          9
+#define MATRIX22_STRASSEN_THRESHOLD         15
 #define HGCD_THRESHOLD                      96
 #define GCD_DC_THRESHOLD                   229
 #define GCDEXT_DC_THRESHOLD                225
@@ -198,5 +198,5 @@
 
 #define GET_STR_DC_THRESHOLD                11
 #define GET_STR_PRECOMPUTE_THRESHOLD        23
-#define SET_STR_DC_THRESHOLD               650
+#define SET_STR_DC_THRESHOLD               802
 #define SET_STR_PRECOMPUTE_THRESHOLD      1781
diff -r d66997641b54 -r accaa23768f7 mpn/x86_64/gmp-mparam.h
--- a/mpn/x86_64/gmp-mparam.h	Thu Feb 25 16:08:31 2010 +0100
+++ b/mpn/x86_64/gmp-mparam.h	Thu Feb 25 18:49:00 2010 +0100
@@ -35,7 +35,7 @@
 
 #define MUL_TOOM22_THRESHOLD                28
 #define MUL_TOOM33_THRESHOLD                81
-#define MUL_TOOM44_THRESHOLD               120
+#define MUL_TOOM44_THRESHOLD               234
 #define MUL_TOOM6H_THRESHOLD               466
 #define MUL_TOOM8H_THRESHOLD               478
 
diff -r d66997641b54 -r accaa23768f7 tests/devel/try.c
--- a/tests/devel/try.c	Thu Feb 25 16:08:31 2010 +0100
+++ b/tests/devel/try.c	Thu Feb 25 18:49:00 2010 +0100
@@ -354,9 +354,10 @@
 #define DATA_SRC0_ODD         3
 #define DATA_SRC0_HIGHBIT     4
 #define DATA_SRC1_ODD         5
-#define DATA_SRC1_HIGHBIT     6
-#define DATA_MULTIPLE_DIVISOR 7
-#define DATA_UDIV_QRNND       8
+#define DATA_SRC1_ODD_PRIME   6
+#define DATA_SRC1_HIGHBIT     7
+#define DATA_MULTIPLE_DIVISOR 8
+#define DATA_UDIV_QRNND       9
   char  data;
 
 /* Default is allow full overlap. */
@@ -633,6 +634,7 @@
 #define TYPE_MPZ_KRONECKER_SI 66
 #define TYPE_MPZ_UI_KRONECKER 67
 #define TYPE_MPZ_SI_KRONECKER 68
+#define TYPE_MPZ_LEGENDRE     69
 
 #define TYPE_AND_N            70
 #define TYPE_NAND_N           71
@@ -1052,6 +1054,17 @@
   REFERENCE (refmpn_gcd);
 
 
+  p = &param[TYPE_MPZ_LEGENDRE];
+  p->retval = 1;
+  p->src[0] = 1;
+  p->size = SIZE_ALLOW_ZERO;
+  p->src[1] = 1;
+  p->data = DATA_SRC1_ODD_PRIME;
+  p->size2 = 1;
+  p->carry = CARRY_BIT;
+  p->carry_sign = 1;
+  REFERENCE (refmpz_legendre);
+
   p = &param[TYPE_MPZ_JACOBI];
   p->retval = 1;
   p->src[0] = 1;
@@ -1588,7 +1601,9 @@
 
   { TRY(mpn_gcd_1),        TYPE_GCD_1            },
   { TRY(mpn_gcd),          TYPE_GCD              },
+  { TRY(mpz_legendre),     TYPE_MPZ_LEGENDRE     },
   { TRY(mpz_jacobi),       TYPE_MPZ_JACOBI       },
+  { TRY(mpz_kronecker),    TYPE_MPZ_KRONECKER    },
   { TRY(mpz_kronecker_ui), TYPE_MPZ_KRONECKER_UI },
   { TRY(mpz_kronecker_si), TYPE_MPZ_KRONECKER_SI },
   { TRY(mpz_ui_kronecker), TYPE_MPZ_UI_KRONECKER },
@@ -2259,6 +2274,14 @@
     }
     break;
 
+  case TYPE_MPZ_LEGENDRE:
+    {
+      mpz_t  a, b;
+      PTR(a) = e->s[0].p; SIZ(a) = (carry==0 ? size : -size);
+      PTR(b) = e->s[1].p; SIZ(b) = size2;
+      e->retval = CALLING_CONVENTIONS (function) (a, b);
+    }
+    break;
   case TYPE_MPZ_JACOBI:
   case TYPE_MPZ_KRONECKER:
     {
@@ -2634,6 +2657,36 @@
 	  s[i].p[0] |= 1;
 	break;
 
+      case DATA_SRC1_ODD_PRIME:
+	if (i == 1)
+	  {
+	    if (refmpn_zero_p (s[i].p+1, SRC_SIZE(i)-1)
+		&& s[i].p[0] <=3)
+	      s[i].p[0] = 3;
+	    else
+	      {
+		mpz_t p;
+		mpz_init (p);
+		for (;;)
+		  {
+		    _mpz_realloc (p, SRC_SIZE(i));
+		    MPN_COPY (PTR(p), s[i].p, SRC_SIZE(i));
+		    SIZ(p) = SRC_SIZE(i);
+		    MPN_NORMALIZE (PTR(p), SIZ(p));
+		    mpz_nextprime (p, p);
+		    if (mpz_size (p) <= SRC_SIZE(i))
+		      break;
+
+		    t_random (s[i].p, SRC_SIZE(i));
+		  }
+		MPN_COPY (s[i].p, PTR(p), SIZ(p));
+		if (SIZ(p) < SRC_SIZE(i))
+		  MPN_ZERO (s[i].p + SIZ(p), SRC_SIZE(i) - SIZ(p));
+		mpz_clear (p);
+	      }		    
+	  }
+	break;
+
       case DATA_SRC1_HIGHBIT:
 	if (i == 1)
 	  {
diff -r d66997641b54 -r accaa23768f7 tests/mpn/t-toom6h.c
--- a/tests/mpn/t-toom6h.c	Thu Feb 25 16:08:31 2010 +0100
+++ b/tests/mpn/t-toom6h.c	Thu Feb 25 18:49:00 2010 +0100
@@ -6,4 +6,6 @@
 #define MIN_AN MUL_TOOM6H_THRESHOLD
 #define MIN_BN(an) (MAX ((an*3)>>3, 42) )
 
+#define COUNT 1000
+
 #include "toom-shared.h"
diff -r d66997641b54 -r accaa23768f7 tests/mpn/t-toom8h.c
--- a/tests/mpn/t-toom8h.c	Thu Feb 25 16:08:31 2010 +0100
+++ b/tests/mpn/t-toom8h.c	Thu Feb 25 18:49:00 2010 +0100
@@ -19,4 +19,6 @@
 #endif
 #endif
 
+#define COUNT 1000
+
 #include "toom-shared.h"
diff -r d66997641b54 -r accaa23768f7 tests/refmpz.c
--- a/tests/refmpz.c	Thu Feb 25 16:08:31 2010 +0100
+++ b/tests/refmpz.c	Thu Feb 25 18:49:00 2010 +0100
@@ -191,10 +191,40 @@
   return refmpz_kronecker (a, b_odd);
 }
 
+/* Legendre symbol via powm. p must be an odd prime. */
 int
-refmpz_legendre (mpz_srcptr a, mpz_srcptr b)
+refmpz_legendre (mpz_srcptr a, mpz_srcptr p)
 {
-  return refmpz_jacobi (a, b);
+  int res;
+
+  mpz_t r;
+  mpz_t e;
+
+  ASSERT_ALWAYS (mpz_sgn (p) > 0);
+  ASSERT_ALWAYS (mpz_odd_p (p));
+  
+  mpz_init (r);
+  mpz_init (e);
+
+  mpz_fdiv_r (r, a, p);
+
+  mpz_set (e, p);
+  mpz_sub_ui (e, e, 1);
+  mpz_fdiv_q_2exp (e, e, 1);
+  mpz_powm (r, r, e, p);
+
+  /* Normalize to a more or less symmetric range around zero */
+  if (mpz_cmp (r, e) > 0)
+    mpz_sub (r, r, p);
+
+  ASSERT_ALWAYS (mpz_cmpabs_ui (r, 1) <= 0);
+
+  res = mpz_sgn (r);
+
+  mpz_clear (r);
+  mpz_clear (e);
+
+  return res;
 }
 
 


More information about the gmp-commit mailing list