[Ecm-commits] r2371 - trunk

cvs commits ecm-commits at lists.gforge.inria.fr
Sun Feb 3 12:14:25 CET 2013


Author: morain
Date: 2013-02-03 12:14:25 +0100 (Sun, 03 Feb 2013)
New Revision: 2371

Log:
Much faster D=-4 algo. More stuff could be done, with more work.


Modified:
   trunk/cmecm.c
   trunk/stage2.c
Modified: trunk/cmecm.c
===================================================================
--- trunk/cmecm.c	2013-02-02 16:46:39 UTC (rev 2370)
+++ trunk/cmecm.c	2013-02-03 11:14:25 UTC (rev 2371)
@@ -635,9 +635,14 @@
 	umin = 1;
 	du = 2;
 #else
+# if 0
 	printf("# Case D=-4 suboptimal, man!\n");
 	umin = 1;
 	du = 1;
+# else
+	printf("# Skipping stuff in rootsG_init_CM\n");
+	return state;
+# endif
 #endif
     }
     

Modified: trunk/stage2.c
===================================================================
--- trunk/stage2.c	2013-02-02 16:46:39 UTC (rev 2370)
+++ trunk/stage2.c	2013-02-03 11:14:25 UTC (rev 2371)
@@ -643,8 +643,26 @@
 	  youpi = ecm_rootsG (f, G, dF, (ecm_roots_state_t *) rootsG_state, 
 			      modulus);
       else
-	  youpi = ecm_rootsG_CM (f, G, dF, (ecm_roots_state_t *) rootsG_state, 
-				 modulus);
+#if CMECM_D_4 == 1
+	  if(disc == -4){
+	      /* we are using G(X) = F(-X), so skip many things! */
+	      printf("# making G(X) = F(-X)\n");
+	      unsigned long j;
+	      for (j = 0; j < dF; j ++){
+		  mpz_set(G[j], F[j]);
+		  if(j & 1){
+		      /* [X^j]G = -[X^j]F */
+		      if(mpz_sgn(G[j]) != 0)
+			  mpz_sub(G[j], modulus->orig_modulus, G[j]);
+		  }
+	      }
+	      goto got_G;
+	  }
+	  else
+#endif
+	      youpi = ecm_rootsG_CM (f, G, dF,
+				     (ecm_roots_state_t *) rootsG_state, 
+				     modulus);
 
       if (test_verbose (OUTPUT_TRACE))
 	{
@@ -676,6 +694,7 @@
       else
         PolyFromRoots (G, G, dF, T + dF, n);
 
+    got_G:
       if (test_verbose (OUTPUT_TRACE))
 	{
 	  unsigned long j;




More information about the Ecm-commits mailing list