[Ecm-commits] r2618 - trunk

cvs commits ecm-commits at lists.gforge.inria.fr
Sun Feb 15 15:49:51 CET 2015


Author: morain
Date: 2015-02-15 15:49:51 +0100 (Sun, 15 Feb 2015)
New Revision: 2618

Modified:
   trunk/addlaws.c
   trunk/test.ecm
   trunk/torsions.c
Log:
Z7 is back after some more debugging. More torsion groups will join later.


Modified: trunk/addlaws.c
===================================================================
--- trunk/addlaws.c	2015-02-15 12:07:11 UTC (rev 2617)
+++ trunk/addlaws.c	2015-02-15 14:49:51 UTC (rev 2618)
@@ -1630,6 +1630,10 @@
 int
 ell_point_duplicate(ell_point_t R, ell_point_t P, ell_curve_t E, mpmod_t n)
 {
+#if DEBUG_ADD_LAWS >= 2
+    printf("E:=");
+    ell_curve_print(E, n);
+#endif
     if(E->type == ECM_EC_TYPE_WEIERSTRASS)
 	return pt_w_duplicate(R->x, R->y, R->z, P->x, P->y, P->z, n, E);
     else if(E->type == ECM_EC_TYPE_HESSIAN)

Modified: trunk/test.ecm
===================================================================
--- trunk/test.ecm	2015-02-15 12:07:11 UTC (rev 2617)
+++ trunk/test.ecm	2015-02-15 14:49:51 UTC (rev 2618)
@@ -333,11 +333,11 @@
 ## a factor is to be found during initialization
 echo 12787261 | $ECM -torsion Z5 -sigma 1000 1e2; checkcode $? 14
 ## a factor is to be found during initialization
-#echo 123041 | $ECM -torsion Z7 -sigma 2 1e2; checkcode $? 14
+echo 123041 | $ECM -torsion Z7 -sigma 2 1e2; checkcode $? 14
 ## a factor is found
-#echo 13290059 | $ECM -torsion Z7 -sigma 4 1e2; checkcode $? 14
+echo 13290059 | $ECM -torsion Z7 -sigma 4 1e2; checkcode $? 14
 ## in step 2
-#echo 2432902008176640001 | $ECM -torsion Z7 -sigma 1 1e3 1e8; checkcode $? 14
+echo 2432902008176640001 | $ECM -torsion Z7 -sigma 1 1e3 1e8; checkcode $? 14
 
 # the following tests should work on machines which have uint64_t or where
 # unsigned long long has 64 bits (exercises patch from David Cleaver, r1575)

Modified: trunk/torsions.c
===================================================================
--- trunk/torsions.c	2015-02-15 12:07:11 UTC (rev 2617)
+++ trunk/torsions.c	2015-02-15 14:49:51 UTC (rev 2618)
@@ -391,14 +391,15 @@
     return ret;
 }
 
-/* INPUT: 
-     T^2 = S^3 + A * S + B
-   => quartic Y^2 = X^4 - 6 * A2 * X^2 + 4 * A1 * X + A0, with
+/* 
+     E_aux: T^2 = S^3 + A * S + B
+   => quartic QC: Y^2 = X^4 - 6 * A2 * X^2 + 4 * A1 * X + A0, with
      X = (T-A1/2)/(S-A2), Y = -X^2 + 2 * S + A2.
    => quartic y^2 = f(x) = a4*x^4+...+a0, where
      x = x0+y0/(X-cte), where cte = f'(x0)/4/y0
      y = Y/y0*(x-x0)^2 = Y*y0/(X-cte)^2
-   SIDE EFFECT: x, y
+   INPUT: (s, t) is a point on E_aux; (x0, y0) a point on QC.
+   SIDE EFFECT: x, y contain a point on the elliptic curve.
    OUTPUT: 1 if no pb occurred,
            0 if a factor was found and put in f
  */
@@ -412,7 +413,7 @@
 
     mpz_init(X);
     mpz_init(Y);
-    /* 1st move */
+    /* X <- (t-A1/2)/(s-A2) */
     mpz_sub(x, t, A1div2);
     mpz_sub(y, s, A2);
     if(mod_from_rat2(X, x, y, n) == 0){
@@ -420,12 +421,13 @@
 	ret = 0;
     }
     else{
+	/* Y <- -X^2 + 2 * s + A2 */
 	mpz_mul(Y, X, X);
 	mpz_sub(Y, A2, Y);
 	mpz_add(Y, Y, s);
 	mpz_add(Y, Y, s);
 	mpz_mod(Y, Y, n);
-	/* 2nd move */
+	/* x <- x0+y0/(X-cte) */
 	mpz_sub(X, X, cte);
 	mpz_mod(X, X, n);
 	if(mpz_invert(f, X, n) == 0){
@@ -478,7 +480,9 @@
     mpres_init(tmp, n);
     mod_from_rat_str(f, "1295/48", n->orig_modulus);
     mpres_set_z(tmp, f, n);
-    ell_curve_init_set(E, ECM_EC_TYPE_WEIERSTRASS, ECM_LAW_HOMOGENEOUS,tmp, n);
+    ell_curve_init_set(E, ECM_EC_TYPE_WEIERSTRASS, ECM_LAW_AFFINE,tmp, n);
+    mod_from_rat_str(f, "-1079/864", n->orig_modulus);
+    mpres_set_z(E->a6, f, n);
     ell_point_init(P, E, n);
     mod_from_rat_str(f, "2185/12", n->orig_modulus);
     mpres_set_z(P->x, f, n);
@@ -522,20 +526,22 @@
 	    ret = ECM_ERROR;
 	    break;
 	}
+	/* come back to plain (not Montgomery) residues */
+	mpres_get_z(b, Q->x, n);
+	mpres_get_z(c, Q->y, n);
 #if DEBUG_TORSION >= 2
+	printf("b:=%Zd; c:=%Zd;\n", b, c);
 	printf("(s, t)[%d]:=", u);
 	pt_print(E, Q, n);
 	printf(";\n");
 #endif
-	/* come back to plain (not Montgomery) residues */
-	mpres_get_z(b, Q->x, n);
-	mpres_get_z(c, Q->y, n);
 	if(cubic_to_quartic(f, n->orig_modulus, d, ky0, b, c, 
 			    A2, A1div2, x0, y0, cte) == 0){
-	    printf("found factor in Z7 (cubic_2_quartic)\n");
+	    printf("found factor in Z7 (cubic_to_quartic)\n");
 	    ret = ECM_FACTOR_FOUND_STEP1;
 	    break;
 	}
+	/* (d, ky0) is a point on y^2 = x^4-18*x^3+13*x^2-28*x+4 */
 	/* d:=x; */
 	/* x0:=-2*d; */
 	mpz_mul_si(kx0, d, -2);



More information about the Ecm-commits mailing list