[Ecm-commits] r2628 - trunk

cvs commits ecm-commits at lists.gforge.inria.fr
Thu Feb 19 20:31:29 CET 2015


Author: morain
Date: 2015-02-19 20:31:29 +0100 (Thu, 19 Feb 2015)
New Revision: 2628

Modified:
   trunk/test.ecm
   trunk/torsions.c
Log:
Z10 is back.


Modified: trunk/test.ecm
===================================================================
--- trunk/test.ecm	2015-02-19 15:03:59 UTC (rev 2627)
+++ trunk/test.ecm	2015-02-19 19:31:29 UTC (rev 2628)
@@ -339,6 +339,7 @@
 ## in step 2
 echo 2432902008176640001 | $ECM -torsion Z7 -sigma 1 1e3 1e8; checkcode $? 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
 
 # the following tests should work on machines which have uint64_t or where

Modified: trunk/torsions.c
===================================================================
--- trunk/torsions.c	2015-02-19 15:03:59 UTC (rev 2627)
+++ trunk/torsions.c	2015-02-19 19:31:29 UTC (rev 2628)
@@ -186,7 +186,7 @@
 	mpz_sub(B, a6, B);
 	mpz_mod(B, B, n);
     }
-#if DEBUG_TORSION >= 0
+#if DEBUG_TORSION >= 2
     gmp_printf("N:=%Zd;\n", n);
     gmp_printf("a2:=%Zd; a4:=%Zd; a6:=%Zd;\n", a2, a4, a6);
     gmp_printf("A:=%Zd; B:=%Zd;\n", A, B);
@@ -307,7 +307,7 @@
     KW2W246(a2, a4, a6, b, c, n, 1);
     /* second conversion */
     MediumWeierstrassToShortWeierstrass(A, B, X, Y, a2, a4, a6, x0, y0, n);
-#if DEBUG_TORSION >= 0
+#if DEBUG_TORSION >= 2
     gmp_printf("a2:=%Zd; a4:=%Zd; a6:=%Zd; A:=%Zd; B:=%Zd\n", a2, a4, a6,A,B);
     gmp_printf("X:=%Zd; Y:=%Zd;\n", X, Y);
 #endif
@@ -316,6 +316,13 @@
     mpz_clear(a6);
 }
 
+static int
+forbidden(char *torsion, int u){
+    if(strcmp(torsion, "Z10") == 0)
+	return u == 1 || u == 2;
+    return 0;
+}
+
 /* Kubert: put b = c. 
    SIDE EFFECT: tE[0..nE[ and tP[0..nE[ receive a curve of torsion Z5
                 and a point on it using parameters [smin..smax[.
@@ -472,7 +479,7 @@
     ell_point_init(Paux, Eaux, n);
     mod_from_rat_str(f, sPx, n->orig_modulus);
     mpres_set_z(Paux->x, f, n);
-    mpz_set_str(f, sPy, 10);
+    mod_from_rat_str(f, sPy, n->orig_modulus);
     mpres_set_z(Paux->y, f, n);
 #if DEBUG_TORSION >= 2
     printf("Paux:=");
@@ -671,7 +678,7 @@
 	    ret = ECM_FACTOR_FOUND_STEP1;
 	    break;
 	}
-#if DEBUG_TORSION >= 0
+#if DEBUG_TORSION >= 2
 	printf("(s, t)[%d]:=", u);
 	pt_print(E, Q, n);
 	printf(";\n");
@@ -794,6 +801,8 @@
     mpz_init(ky0);
     ell_point_init(Q, E, n);
     for(u = umin; u < umax; u++){
+	if(forbidden("Z10", u))
+	    continue;
 	/* update Qaux */
 	mpz_set_ui(d, u);
 	if(ell_point_mul(Q, d, P, E, n) == 0){
@@ -802,7 +811,7 @@
 	    ret = ECM_FACTOR_FOUND_STEP1;
 	    break;
 	}
-#if DEBUG_TORSION >= 0
+#if DEBUG_TORSION >= 2
 	printf("(s, t)[%d]:=", u);
 	pt_print(E, Q, n);
 	printf(";\n");
@@ -882,8 +891,8 @@
 	if(nc >= nE)
 	    break;
     }
-#if DEBUG_TORSION >= 0
-    if(ret != ECM_ERROR){
+#if DEBUG_TORSION >= 2
+    if(ret != ECM_ERROR && nc > 0){
 	printf("Curves built\n");
 	pt_many_print(tE, tP, nE, n);
     }
@@ -2200,7 +2209,7 @@
     int ret, smin, smax;
 
     smin = (int)mpz_get_si(sigma);
-    smax = smin + 1;
+    smax = 10*smin;
     mpmod_init(modulus, n, ECM_MOD_DEFAULT);
     ret = build_curves_with_torsion(f, modulus, tE, tP, torsion, smin, smax, 1,
 				    0, NULL);



More information about the Ecm-commits mailing list