[Ecm-commits] r2602 - trunk

cvs commits ecm-commits at lists.gforge.inria.fr
Wed Feb 11 11:08:49 CET 2015


Author: zimmerma
Date: 2015-02-11 11:08:49 +0100 (Wed, 11 Feb 2015)
New Revision: 2602

Modified:
   trunk/ecm-impl.h
   trunk/ecm2.c
Log:
removed dead code


Modified: trunk/ecm-impl.h
===================================================================
--- trunk/ecm-impl.h	2015-02-11 09:39:42 UTC (rev 2601)
+++ trunk/ecm-impl.h	2015-02-11 10:08:49 UTC (rev 2602)
@@ -371,9 +371,6 @@
                           mpmod_t);
 #define ecm_rootsG_clear __ECM(ecm_rootsG_clear)
 void    ecm_rootsG_clear (ecm_roots_state_t *, mpmod_t);
-#define ecm_findmatch __ECM(ecm_findmatch)
-int     ecm_findmatch (unsigned long *, const unsigned long, root_params_t *, 
-                       const curve *, mpmod_t, const mpz_t);
 
 /* lucas.c */
 #define pp1_mul_prac __ECM(pp1_mul_prac)

Modified: trunk/ecm2.c
===================================================================
--- trunk/ecm2.c	2015-02-11 09:39:42 UTC (rev 2601)
+++ trunk/ecm2.c	2015-02-11 10:08:49 UTC (rev 2602)
@@ -861,186 +861,3 @@
   
   return youpi;
 }
-
-
-/* Find smallest i >= 0 such that 
-   f(j * d2)*X = +-f((i0 + i) * d1)*X over GF(p).
-   If "+" holds, return 1, if "-" holds, return -1.
-   If the correct i could not be determined (because a non-invertible 
-   residue appeared during initialisation) return 0. */
-int 
-ecm_findmatch (unsigned long *I, const unsigned long j, 
-               root_params_t *root_params, const curve *X, mpmod_t n, 
-               const mpz_t p)
-{
-  const int dickson_a = root_params->S < 0 ? -1 : 0;
-  const unsigned int S = abs (root_params->S);
-  const unsigned int sizeT = S + 3;
-  unsigned int k;
-  unsigned long i;
-  int r, sgn = 0;
-  point iX, jX;
-  curve Xp; /* The point and curve over GF(p) */
-  mpmod_t modulus;
-  mpz_t s, t; /* temp vars */
-  mpres_t u, v; /* temp vars */
-  listz_t coeffs;
-  point *fd;
-  mpres_t *T;
-  
-  outputf (OUTPUT_RESVERBOSE, "Looking for i such that "
-           "f((i+%Zd)*%lu)*X = f(%lu*%lu)*X\n", root_params->i0, 
-           root_params->d1, j, root_params->d2);
-  
-  mpmod_init (modulus, p, ECM_MOD_DEFAULT);
-  mpz_init (s);
-  mpz_init (t);
-  mpres_init (u, modulus);
-  mpres_init (v, modulus);
-  mpres_init (Xp.x, modulus);
-  mpres_init (Xp.y, modulus);
-  mpres_init (Xp.A, modulus);
-  mpres_init (iX.x, modulus);
-  mpres_init (iX.y, modulus);
-  mpres_init (jX.x, modulus);
-  mpres_init (jX.y, modulus);
-  T = malloc (sizeT * sizeof (mpres_t));
-  if (T == NULL)
-    goto clear_and_exit;
-  for (k = 0; k < sizeT; k++)
-    mpres_init (T[k], modulus);
-  fd = malloc ((S + 1) * sizeof (point));
-  if (fd == NULL)
-    goto clear_T_and_exit;
-  for (k = 0; k < S + 1; k++)
-    {
-      mpres_init (fd[k].x, modulus);
-      mpres_init (fd[k].y, modulus);
-    }
-
-  /* Copy the parameters of the curve over Z/ZN to the curve over GF(p) */
-  mpres_get_z (t, X->x, n);
-  mpres_set_z (Xp.x, t, modulus);
-  mpres_get_z (t, X->y, n);
-  mpres_set_z (Xp.y, t, modulus);
-  mpres_get_z (t, X->A, n);
-  mpres_set_z (Xp.A, t, modulus);
-  
-  /* We use init_progression_coeffs() to compute f(j * d2) */
-  mpz_set_ui (t, j);
-  coeffs = init_progression_coeffs (t, 1UL, root_params->d2, 1U, 1U, S, 
-                                    dickson_a);
-  if (coeffs == NULL)
-    goto clear_fd_and_exit;
-  
-  /* Now compute f(j * d2) X */
-  r = multiplyW2n (NULL, &jX, &Xp, coeffs, 1U, modulus, u, v, T, NULL, NULL);
-  clear_list (coeffs, S + 1);
-  if (r != ECM_NO_FACTOR_FOUND)
-    goto clear_fd_and_exit;
-
-  /* We'll keep {f(j * d2) X}_x in s */
-  mpres_get_z (s, jX.x, modulus);
-  outputf (OUTPUT_DEVVERBOSE, "ecm_findmatch: (f(j * d2) X)_x = %Zd\n", s);
-
-  /* Now compute {f((i0 + i) d1) X}_x one at a time and put them in t, 
-     until s == t */
-  
-  /* Init the progression */
-  coeffs = init_progression_coeffs (root_params->i0, 1UL, root_params->d1, 
-                                    1U, 1U, S, dickson_a);
-  if (coeffs == NULL)
-    goto clear_fd_and_exit;
-  r = multiplyW2n (NULL, fd, &Xp, coeffs, S + 1, modulus, u, v, T, NULL, NULL);
-  clear_list (coeffs, S + 1);
-  if (r != ECM_NO_FACTOR_FOUND)
-    goto clear_fd_and_exit;
-  
-  mpres_get_z (t, fd[0].x, modulus);
-  for (i = 0; mpz_cmp (s, t) != 0; i++)
-    {
-      r = addWnm (NULL, fd, &Xp, modulus, 1, S, T, NULL, NULL);
-      if (r != ECM_NO_FACTOR_FOUND)
-        goto clear_fd_and_exit;
-      mpres_get_z (t, fd[0].x, modulus);
-    }
-
-  outputf (OUTPUT_DEVVERBOSE, "ecm_findmatch: i - i0 = %lu, "
-           "{f(i * d1) X}_x = %Zd\n", i, t);
-
-  /* We'll compute f(i * d1)*X and compare it to f(j * d2)*X to verify 
-     correctness of the result, and to determine whether it was
-     f(i * d1)-f(j * d2) or f(i * d1)+f(j * d2) that found the factor */
-  /* We use init_progression_coeffs() to compute f(i * d1) */
-  mpz_add_ui (t, root_params->i0, i);
-  coeffs = init_progression_coeffs (t, 1UL, root_params->d1, 1U, 1U, S, 
-                                    dickson_a);
-  if (coeffs == NULL)
-    goto clear_fd_and_exit;
-  
-  /* Now compute iX = f(i * d1)*X */
-  r = multiplyW2n (NULL, &iX, &Xp, coeffs, 1U, modulus, u, v, T, NULL, NULL);
-  clear_list (coeffs, S + 1);
-  if (r != ECM_NO_FACTOR_FOUND)
-    goto clear_fd_and_exit;
-  
-  mpres_get_z (t, iX.x, modulus);
-  if (mpz_cmp (s, t) != 0)
-    {
-      outputf (OUTPUT_ERROR, "ecm_findmatch: ERROR, (f(i*d1) X)_x != "
-               "(f(j*d2) X)_x\n(f(i*d1) X)_x = %Zd\n", t);
-      goto clear_fd_and_exit;
-    }
-
-  mpres_get_z (s, jX.y, modulus);
-  mpres_get_z (t, iX.y, modulus);
-  if (mpz_cmp (s, t) == 0)
-    {
-      *I = i;
-      sgn = 1;
-    }
-  else
-    {
-      mpz_sub (t, p, t);
-      if (mpz_cmp (s, t) == 0)
-        {
-          *I = i;
-          sgn = -1;
-        }
-      else
-        {
-          mpz_sub (t, p, t);
-          outputf (OUTPUT_ERROR, "ecm_findmatch: ERROR, (f(i*d1) X)_y != "
-                   "+-(f(j*d2) X)_y\n");
-          outputf (OUTPUT_ERROR, "(f(i*d1) X)_y = %Zd\n", t);
-          outputf (OUTPUT_ERROR, "(f(j*d2) X)_y = %Zd\n", s);
-        }
-    }
-
-clear_fd_and_exit:
-  for (k = 0; k < S + 1; k++)
-    {
-      mpres_clear (fd[k].x, modulus);
-      mpres_clear (fd[k].y, modulus);
-    }
-  free(fd);
-clear_T_and_exit:
-  for (k = 0; k < sizeT; k++)
-    mpres_clear (T[k], modulus);
-  free (T);
-clear_and_exit:
-  mpz_clear (s);
-  mpz_clear (t);
-  mpres_clear (u, modulus);
-  mpres_clear (v, modulus);
-  mpres_clear (Xp.x, modulus);
-  mpres_clear (Xp.y, modulus);
-  mpres_clear (Xp.A, modulus);
-  mpres_clear (iX.x, modulus);
-  mpres_clear (iX.y, modulus);
-  mpres_clear (jX.x, modulus);
-  mpres_clear (jX.y, modulus);
-  mpmod_clear (modulus);
-  
-  return sgn;
-}



More information about the Ecm-commits mailing list