[Ecm-commits] r2575 - in trunk: . aprtcle

cvs commits ecm-commits at lists.gforge.inria.fr
Mon Feb 2 13:31:35 CET 2015


Author: dcleaver
Date: 2015-02-02 13:31:34 +0100 (Mon, 02 Feb 2015)
New Revision: 2575

Modified:
   trunk/aprtcle/mpz_aprcl.c
   trunk/ecm-ecm.h
   trunk/test.ecm
Log:
Remove unused code in mpz_aprcl, adjust aprcl limits, add test in test.ecm to exercise phi in eval.c

Modified: trunk/aprtcle/mpz_aprcl.c
===================================================================
--- trunk/aprtcle/mpz_aprcl.c	2015-02-02 06:41:14 UTC (rev 2574)
+++ trunk/aprtcle/mpz_aprcl.c	2015-02-02 12:31:34 UTC (rev 2575)
@@ -474,15 +474,7 @@
   for (I = 0; I < PL; I++)
     mpz_set_si(aiJ0[I], sls[jpqs[a].index+I]);
 }
-/* ============================================================================================== */
 
-int mpz_aprcl(mpz_t N)
-{
-  /* Just return the status of the input */
-  /* Do not print out any progress information */
-  return mpz_aprtcle(N, APRTCLE_VERBOSE0);
-}
-
 /* ============================================================================================== */
 
 /* Prime checking routine                       */
@@ -524,8 +516,6 @@
   NumberLength = mpz_sizeinbase(N, 10);
   if (NumberLength > 7000)
   {
-    if (verbose >= APRTCLE_VERBOSE2)
-      printf(" Info: Number too large, returning mpz_probab_prime_p(N)\n");
     return mpz_probab_prime_p(N, 1); // mpz_probab_prime_p mpz_bpsw_prp
   }
 
@@ -595,8 +585,6 @@
       if (i >= NP)
       { /* too big */
         free_vars();
-        if (verbose >= APRTCLE_VERBOSE2)
-          printf(" ERROR: Not enough primes in P to fully process T, returning mpz_probab_prime_p(N)\n");
         return mpz_probab_prime_p(N, 1);
       }
 
@@ -1020,8 +1008,6 @@
             if (W != P - 1)
             {
               /* Not prime */
-              if (verbose >= APRTCLE_VERBOSE2)
-                {printf("Failed: W != P - 1 : H=%d : W=%d : P-1=%d\n", H, W, P-1); fflush(stdout);}
               free_vars();
               return APRTCLE_COMPOSITE;
             }
@@ -1038,8 +1024,6 @@
             if (I == PM)
             {
               /* Not prime */
-              if (verbose >= APRTCLE_VERBOSE2)
-                {printf("Failed: I == PM : I=%d : PM=%d\n", I, PM); fflush(stdout);}
               free_vars();
               return APRTCLE_COMPOSITE;
             }
@@ -1051,11 +1035,6 @@
               if (mpz_cmp_ui(biTmp, 0) != 0)/* (!BigNbrIsZero(biTmp)) */
               {
                 /* Not prime */
-                if (verbose >= APRTCLE_VERBOSE2)
-                {
-                  printf("Failed: biTmp != 0 (1)\n");
-                  gmp_printf("biTmp=%Zd\n", biTmp); fflush(stdout);
-                }
                 free_vars();
                 return APRTCLE_COMPOSITE;
               }
@@ -1097,11 +1076,6 @@
           if (mpz_cmp_ui(biTmp, 0) != 0)/* (!BigNbrIsZero(biTmp)) */
           {
             /* Not prime */
-            if (verbose >= APRTCLE_VERBOSE2)
-            {
-              printf("Failed: biTmp != 0 (2)\n");
-              gmp_printf("biTmp = %Zd\n", biTmp); fflush(stdout);
-            }
             free_vars();
             return APRTCLE_COMPOSITE;
           }
@@ -1128,8 +1102,6 @@
           LEVELnow++;
           if (LEVELnow == LEVELmax)
           {
-            if (verbose >= APRTCLE_VERBOSE2)
-              {printf("APR-CL cannot tell: lvlnow == lvlmax, returning mpz_probab_prime_p(N)\n"); fflush(stdout);}
             free_vars();
             return mpz_probab_prime_p(N, 1); /* Cannot tell */
           }
@@ -1156,8 +1128,6 @@
               goto MainStart;
             }
           } /* end for J */
-          if (verbose >= APRTCLE_VERBOSE2)
-            {printf("Failed: APR-CL error, returning mpz_probab_prime_p(N)\n"); fflush(stdout);}
           free_vars();
           return mpz_probab_prime_p(N, 1); /* Program error */
         } /* end if */
@@ -1186,17 +1156,13 @@
       if (mpz_divisible_p(TestNbr, biR) && mpz_cmp(biR, TestNbr) < 0) /* biR < N and biR | TestNbr */
       {
         /* Number is composite */
-        if (verbose >= APRTCLE_VERBOSE2)
-          {gmp_printf(" *** Found factor: %Zd\n", biR); fflush(stdout);}
         free_vars();
         return APRTCLE_COMPOSITE;
       }
     } /* End for U */
     /* This should never be reached. */
-    if (verbose >= APRTCLE_VERBOSE2)
-      {printf("Failed: APR-CL error with final test, returning mpz_probab_prime_p(N)\n"); fflush(stdout);}
     free_vars();
-    return mpz_probab_prime_p(N, 1); /* Program error */
+    return mpz_probab_prime_p(N, 1);
   }
 }
 

Modified: trunk/ecm-ecm.h
===================================================================
--- trunk/ecm-ecm.h	2015-02-02 06:41:14 UTC (rev 2574)
+++ trunk/ecm-ecm.h	2015-02-02 12:31:34 UTC (rev 2575)
@@ -192,7 +192,7 @@
                               progress */
 /* Cutoff value: Use APRCL if n has fewer digits than cutoff2
                  Use mpz_probab_prime_p if n has more digits than cutoff2 */
-#define APRCL_CUTOFF2 1000 /* for more than APRCL_CUTOFF2 digits, perform
+#define APRCL_CUTOFF2 500 /* for more than APRCL_CUTOFF2 digits, perform
                               a pseudo-primality test */
 
 #endif /* _ECM_ECM_H */

Modified: trunk/test.ecm
===================================================================
--- trunk/test.ecm	2015-02-02 06:41:14 UTC (rev 2574)
+++ trunk/test.ecm	2015-02-02 12:31:34 UTC (rev 2575)
@@ -195,6 +195,10 @@
 
 fi
 
+# test to exercise the Phi code in eval.c
+echo "Phi(101,30)" | $ECM -sigma 0:12023436370081639188 1e5
+checkcode $? 14
+
 # this example would fail with the old Fgw.c when using gwnum (fixed by David Cleaver, r1734)
 echo "((173^173+1)/174)/471462511391940575680645418941" | $ECM -param 0 -sigma 12345 20000
 checkcode $? 0



More information about the Ecm-commits mailing list