[Ecm-commits] r2635 - trunk

cvs commits ecm-commits at lists.gforge.inria.fr
Tue Feb 24 18:39:09 CET 2015


Author: morain
Date: 2015-02-24 18:39:09 +0100 (Tue, 24 Feb 2015)
New Revision: 2635

Modified:
   trunk/ecm.c
   trunk/main.c
   trunk/test.ecm
Log:
cleaning things so that -torsion and save/resume can be used jointly.


Modified: trunk/ecm.c
===================================================================
--- trunk/ecm.c	2015-02-24 07:08:53 UTC (rev 2634)
+++ trunk/ecm.c	2015-02-24 17:39:09 UTC (rev 2635)
@@ -1250,26 +1250,13 @@
               youpi = get_curve_from_param2 (f, P.A, P.x, sigma, modulus);
           else if (*param == ECM_PARAM_BATCH_32BITS_D)
               youpi = get_curve_from_param3 (P.A, P.x, sigma, modulus);
-          else if (*param == ECM_PARAM_TORSION)
-	    {
-	      if(E->type == ECM_EC_TYPE_WEIERSTRASS)
-		  mpres_set_z(P.A, zE->a4, modulus);
-	      else if(E->type == ECM_EC_TYPE_MONTGOMERY)
-		  mpres_set_z(P.A, zE->a2, modulus);
-	    }
-	  else
+          else
             {
               outputf (OUTPUT_ERROR, "Error, invalid parametrization.\n");
               youpi = ECM_ERROR;
 	            goto end_of_ecm;
             }
       
-          /* FIXME: find another way to test this */
-	  /* if x != 0 we use this value for the starting point */ 
-          if (mpz_sgn(x) != 0){ /* humf */
-              mpres_set_z (P.x, x, modulus);
-              mpres_set_z (P.y, y, modulus);
-	  }
           if (youpi != ECM_NO_FACTOR_FOUND)
             {
               if (youpi == ECM_ERROR)
@@ -1324,9 +1311,21 @@
 			   on some special curves.
 			*/
     {
-      mpres_set_z (P.A, sigma, modulus); /* sigma contains A */
-      mpres_set_z (P.x, x,    modulus);
-      mpres_set_z (P.y, y,    modulus);
+	if (*param != ECM_PARAM_TORSION)
+	  {
+	      mpres_set_z (P.A, sigma, modulus); /* sigma contains A */
+	      mpres_set_z (P.x, x,    modulus);
+	      mpres_set_z (P.y, y,    modulus);
+	  }
+	else
+	  {
+	      if(E->type == ECM_EC_TYPE_WEIERSTRASS)
+		  mpres_set_z(P.A, zE->a4, modulus);
+	      else if(E->type == ECM_EC_TYPE_MONTGOMERY)
+		  mpres_set_z(P.A, zE->a2, modulus);
+              mpres_set_z (P.x, x, modulus);
+              mpres_set_z (P.y, y, modulus);
+	  }
     }
 
   if (test_verbose (OUTPUT_RESVERBOSE))
@@ -1402,7 +1401,13 @@
 	    }
 	}
     }
-  
+  else
+    {
+	/* we need to initialize P */
+	mpres_set_z (P.x, x, modulus);
+	mpres_set_z (P.y, y, modulus);
+    }
+
   if (stage1time > 0.)
     {
       const long st2 = elltime (st, cputime ());

Modified: trunk/main.c
===================================================================
--- trunk/main.c	2015-02-24 07:08:53 UTC (rev 2634)
+++ trunk/main.c	2015-02-24 17:39:09 UTC (rev 2635)
@@ -1392,6 +1392,7 @@
 	  else if (torsion != NULL)
 	    {
 	      params->param = ECM_PARAM_TORSION;
+	      params->sigma_is_A = -1;
 	      result = build_curves_with_torsion2 (f, n.n, params->E, 
 						   params->x, params->y,
                                                    torsion, sigma);

Modified: trunk/test.ecm
===================================================================
--- trunk/test.ecm	2015-02-24 07:08:53 UTC (rev 2634)
+++ trunk/test.ecm	2015-02-24 17:39:09 UTC (rev 2635)
@@ -360,6 +360,12 @@
 echo 13290059 | $ECM -torsion Z7 -sigma 4 1e2; checkcode $? 14
 ## in step 2
 echo 2432902008176640001 | $ECM -torsion Z7 -sigma 1 1e3 1e8; checkcode $? 14
+## -save/-resume
+echo 2432902008176640001 | $ECM -torsion Z7 -save test.ecm.save -sigma 1 1e3
+$ECM -resume test.ecm.save 1e3 1e8
+C=$?
+/bin/rm -f test.ecm.save
+checkcode $C 14
 echo 2432902008176640001 | $ECM -torsion Z9 -sigma 3 13000; checkcode $? 14
 echo 2432902008176640001 | $ECM -torsion Z10 -sigma 3 320; checkcode $? 14
 echo 2432902008176640001 | $ECM -torsion Z2xZ8 -sigma 2 1300; checkcode $? 14



More information about the Ecm-commits mailing list