[Ecm-commits] r2443 - trunk

cvs commits ecm-commits at lists.gforge.inria.fr
Thu Feb 28 18:01:55 CET 2013


Author: morain
Date: 2013-02-28 18:01:54 +0100 (Thu, 28 Feb 2013)
New Revision: 2443

Log:
Cosmetic changes + preparing the use of curves having torsion group
Z/11Z over some quadratic field.



Added:
   trunk/multiecm.c
Removed:
   trunk/manyecm.c
Modified:
   trunk/Makefile.am
   trunk/torsions.c
   trunk/torsions.h
Modified: trunk/Makefile.am
===================================================================
--- trunk/Makefile.am	2013-02-27 15:42:24 UTC (rev 2442)
+++ trunk/Makefile.am	2013-02-28 17:01:54 UTC (rev 2443)
@@ -49,7 +49,7 @@
 endif
 
 bin_PROGRAMS = ecm
-noinst_PROGRAMS = tune ecmfactor bench_mulredc manyecm
+noinst_PROGRAMS = tune ecmfactor bench_mulredc multiecm
 # Most binaries want to link libecm.la, and the ones which don't will
 # have their own _LDADD which overrides the default LDADD here
 LDADD = libecm.la $(GMPLIB)
@@ -71,10 +71,10 @@
 
 ecmfactor_CFLAGS = $(OPENMP_CFLAGS)
 
-manyecm_CPPFLAGS = -DOUTSIDE_LIBECM
-manyecm_SOURCES = auxi.c b1_ainc.c candi.c eval.c random.c manyecm.c \
+multiecm_CPPFLAGS = -DOUTSIDE_LIBECM
+multiecm_SOURCES = auxi.c b1_ainc.c candi.c eval.c random.c multiecm.c \
               resume.c getprime.c addlaws.c torsions.c cmecm.c
-manyecm_CFLAGS = $(OPENMP_CFLAGS)
+multiecm_CFLAGS = $(OPENMP_CFLAGS)
 
 rho_SOURCES = rho.c
 rho_CPPFLAGS = -DTESTDRIVE

Deleted: trunk/manyecm.c
===================================================================
--- trunk/manyecm.c	2013-02-27 15:42:24 UTC (rev 2442)
+++ trunk/manyecm.c	2013-02-28 17:01:54 UTC (rev 2443)
@@ -1,1287 +0,0 @@
-/* manyecm.c - ECM with many curves with many torsion and/or in parallel 
-   Author: F. Morain
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#include <gmp.h> /* GMP header file */
-
-#include "ecm.h" /* ecm header file */
-#include "ecm-impl.h"
-#include "ecm-ecm.h"
-#include "mpmod.h"
-
-#include "addlaws.h"
-#include "torsions.h"
-#include "cmecm.h"
-
-#define DEBUG_MANY_EC 0
-
-#define NCURVE_MAX 2000
-
-/* fall back on traditional ECM.
-   TODO: use chkfile also.
- */
-int
-process_one_curve(mpz_t f, mpz_t N, double B1, mpz_t B2,
-		  ecm_params params, ell_curve_t E, ell_point_t P)
-{
-    int ret;
-    double B2scale = 1.0;
-
-    /* Taken from main.c; no comment */
-    /* Here's an ugly hack to pass B2scale to the library somehow.
-       It gets piggy-backed onto B1done */
-    params->B1done = params->B1done + floor (B2scale * 128.) / 134217728.; 
-
-    /* if B2 = ECM_DEFAULT_B2, compute it automatically from B1: 
-       no freedom on B2! */
-    mpz_set(params->B2, B2);
-    /* will be set to B1 */
-    mpz_set_si(params->B2min, ECM_DEFAULT_B2);
-
-    mpz_set(params->x, P->x);
-    mpz_set(params->sigma, E->A); /* humf */
-
-    if(E->type == ECM_EC_TYPE_MONTGOMERY)
-	params->sigma_is_A = 1;
-    else{
-	params->sigma_is_A = -1;
-	mpz_set(params->y, P->y);
-    }
-    params->E = E;
-
-    ret = ecm_factor(f, N, B1, params);
-    return ret;
-}
-
-/* OUTPUT: ECM_PRIME_FAC_PRIME_COFAC if f prp, N/f prp
-           ECM_PRIME_FAC_COMP_COFAC if f prp, N/f composite
-	   ECM_COMP_FAC_PRIME_COFAC if f composite, N/f prp
-           ECM_COMP_FAC_COMP_COFAC if f composite, N/f composite
- */
-int
-conclude_on_factor(mpz_t N, mpz_t f, int verbose)
-{
-    mpz_t C;
-    int factor_is_prime, cofactor_is_prime, ret;
-
-    if(mpz_cmp(N, f) == 0){
-	printf("# found input number\n");
-	return ECM_INPUT_NUMBER_FOUND;
-    }
-    factor_is_prime = mpz_probab_prime_p (f, PROBAB_PRIME_TESTS);
-    mpz_init(C);
-    mpz_tdiv_q(C, N, f);
-    cofactor_is_prime = mpz_probab_prime_p (C, PROBAB_PRIME_TESTS);
-    if (factor_is_prime)
-	ret = cofactor_is_prime ? ECM_PRIME_FAC_PRIME_COFAC :
-	    ECM_PRIME_FAC_COMP_COFAC;
-    else
-	ret = cofactor_is_prime ? ECM_COMP_FAC_PRIME_COFAC :
-	    ECM_COMP_FAC_COMP_COFAC;
-    if (verbose >= 1)
-      {
-        printf ("Found %s factor of %2u digits: ", 
-		factor_is_prime ? "probable prime" : "composite",
-		nb_digits (f));
-	mpz_out_str (stdout, 10, f);
-	printf ("\n");
-	printf ("%s cofactor ",
-		cofactor_is_prime ? "Probable prime" : "Composite");
-	mpz_out_str (stdout, 10, C);
-	printf (" has %u digits\n", nb_digits(C));
-      }
-    mpz_clear(C);
-    return ret;
-}
-
-/* f is a (probable) prime factor of n. tP is in plain mod n form. */
-void
-dump_curves(ell_curve_t *tE, ell_point_t *tP, int nE, mpz_t f)
-{
-    int i;
-
-    gmp_printf("p:=%Zd; F:=GF(p); P:=[]; A:=[]; B:=[]; E:=[]; D:=[];\n", f);
-    printf("CheckE:=procedure(E, D, P, info)\n");
-    printf("    K:=QuadraticField(D); OK:=MaximalOrder(K);\n");
-    printf("    printf \"#E[%%o]=%%o\\n\", info, Factorization(#E);\n");
-    printf("    gen:=Generators(E);\n");
-    printf("    printf \"ords=%%o\\n\", ");
-    printf("[Factorization(Order(g)) : g in gen];\n");
-    printf("    lf:=Factorization(Order(E!P));\n");
-    printf("    printf \"ord(P)=%%o\\n\", lf;\n");
-    printf("    for i:=1 to #lf do\n");
-    printf("        lfi:=Factorization(lf[i][1]*OK);\n");
-    printf("        ok,gen:=IsPrincipal(lfi[1][1]);\n");
-    printf("        print lf[i], ok, gen;\n");
-    printf("    end for;\n");
-    printf("end procedure;\n");
-    for(i = 0; i < nE; i++){
-	printf("D[%d]:=%d;\n", i+1, tE[i]->disc);
-	if(tE[i]->type == ECM_EC_TYPE_MONTGOMERY){
-	    mpmod_t fmod;
-	    mpres_t x, y, A;
-	    mpz_t tmp;
-
-	    mpz_init(tmp);
-	    mpmod_init(fmod, f, ECM_MOD_DEFAULT);
-	    mpres_init(x, fmod);
-	    mpres_set_z(x, tP[i]->x, fmod);
-	    mpres_init(y, fmod);
-	    mpres_init(A, fmod);
-	    mpres_set_z(A, tE[i]->A, fmod);
-	    if(montgomery_to_weierstrass(tmp, x, y, A, fmod) == ECM_FACTOR_FOUND_STEP1){
-		printf("GASP in dump!\n");
-	    }
-	    printf("P[%d]:=[", i+1); print_mpz_from_mpres(x, fmod);
-	    printf(", "); print_mpz_from_mpres(y,fmod);
-	    printf(", 1];\n");
-	    printf("A[%d]:=", i+1);
-	    print_mpz_from_mpres(A, fmod);
-	    printf(";\n");
-	    mpres_clear(x, fmod);
-	    mpres_clear(y, fmod);
-	    mpres_clear(A, fmod);
-	    mpmod_clear(fmod);
-	    mpz_clear(tmp);
-	}
-	else if(tE[i]->type == ECM_EC_TYPE_WEIERSTRASS){
-	    gmp_printf("P[%d]:=[%Zd, %Zd, %Zd];\n", i+1, 
-		       tP[i]->x, tP[i]->y, tP[i]->z); 
-	    gmp_printf("A[%d]:=%Zd;\n", i+1, tE[i]->A);
-	}
-	else{
-	    printf("Case %d NYI in dump_curves\n", tE[i]->type);
-	    break;
-	}
-	printf("B[%d]:=P[%d][2]^2-P[%d][1]^3-A[%d]*P[%d][1];\n", 
-	       i+1, i+1, i+1, i+1, i+1);
-	printf("E[%d]:=EllipticCurve([F!A[%d], F!B[%d]]);\n", i+1, i+1, i+1);
-	printf("CheckE(E[%d], D[%d], P[%d], infos[%d]);\n",i+1,i+1,i+1,i+1);
-    }
-}
-
-/* TODO: better control of B2 + dichotomy (cf. #B2) */
-int
-one_curve_at_a_time(mpz_t f, char *ok, ell_curve_t *tE, ell_point_t *tP, int nE,
-		    mpz_t N, ecm_params params, double B1, mpz_t B2,
-		    char *savefilename)
-{
-    double tmpB1, tmpB2, B2g = 0, B2d = 0, dB2 = 0; /* 1e9; #B2 */
-    int ret = 0, i, saveit, nhit, nhitmax = 1; /* #B2 */
-    mpcandi_t candi;
-    char comment[256] = "";
-    mpz_t C;
-
-    mpcandi_t_init(&candi);
-    mpcandi_t_add_candidate(&candi, N, NULL, 0);
-    mpz_init(C);
-    /* process curves one at a time */
-    for(i = 0; i < nE; i++){
-	tmpB1 = B1;
-	tmpB2 = dB2;
-	nhit = 0;
-	while(1){
-#if DEBUG_MANY_EC >= 2
-	    printf("infos:=[\"E%d\"];\n", i);
-	    dump_curves(tE+i, tP+i, 1, N);
-#endif
-	    params->B1done = 1.0;
-#if 0 /* #B2 */
-	    mpz_set_d(params->B2, tmpB2);
-#endif
-	    if(nhit > 0){
-		tmpB2 = (B2d+B2g)/2;
-		printf("# trying new B2[%d]=%f\n", nhit, tmpB2);
-	    }
-	    ret = process_one_curve(f,N,tmpB1,B2,params,tE[i],tP[i]);
-	    if(ret == ECM_NO_FACTOR_FOUND){
-		if(nhit == 0)
-		    /* no factor found in any step */
-		    break;
-		else{
-		    /* we are in some recursive step */
-		    printf("# B1done=%.0f\n", params->B1done);
-		    if(params->B1done == tmpB1)
-			/* dichotomy for step 2 */
-			B2g = tmpB2;
-		}
-	    }
-	    else if(ret == ECM_FACTOR_FOUND_STEP1){
-		if(mpz_cmp(f, N) != 0)
-		    /* non-trivial factor found */
-		    break;
-		else{
-		    tmpB1 = params->B1done - 1;
-		    printf("# trying again with B1=%.0f\n", tmpB1);
-		}
-	    }
-	    else if(ret == ECM_FACTOR_FOUND_STEP2){
-		if(mpz_cmp(f, N) != 0)
-		    /* non-trivial factor found */
-		    break;
-		else{
-		    if(nhit == 0)
-			B2g = 0;
-		    B2d = tmpB2;
-		}
-	    }
-	    else
-		break;
-	    nhit++;
-	    if(nhit == nhitmax) /* caution, Lemmy! */
-		break;
-	}
-	saveit = (savefilename != NULL);
-	if(ret > 0){ /* humf */
-	    ok[i] = 0;
-	    ret = conclude_on_factor(N, f, params->verbose);
-	    if(ret == ECM_INPUT_NUMBER_FOUND){
-		printf("# B1done=%.0f\n", params->B1done);
-		printf("# proceeding to next curve\n");
-		saveit = 0;
-	    }
-	    else{
-#if DEBUG_MANY_EC >= 0
-		if(ret == ECM_PRIME_FAC_PRIME_COFAC 
-		   || ret == ECM_PRIME_FAC_COMP_COFAC){
-		    /* output Magma lines to check #E's mod f */
-		    printf("infos:=[\"E%d\"];\n", i);
-		    dump_curves(tE+i, tP+i, 1, f);
-		}
-#endif
-		break;
-	    }
-	}
-	else if(ret == ECM_ERROR){
-	    printf("Error for curve %d\n", i);
-	}
-	if(saveit){
-	    write_resumefile(savefilename, ECM_ECM, N, params, &candi, 
-			     tP[i]->x, tP[i]->y, comment);
-	}
-
-    }
-#if DEBUG_MANY_EC >= 2
-    printf("# let's debug all curves\n");
-    dump_curves(tE, tP, nE, N);
-#endif
-    mpz_clear (C);
-    mpcandi_t_free(&candi);
-    return ret;
-}
-
-/* Using parallelism.
-   Copied from classical ecm_stage1.
- */
-int
-all_curves_at_once(mpz_t f, char *ok, ell_curve_t *tE, ell_point_t *tP, int nE,
-		   mpmod_t n, double B1, double *B1done, 
-		   int (*stop_asap)(void), char *chkfilename)
-{
-    ell_point_t tQ[NCURVE_MAX], tR[NCURVE_MAX];
-    mpz_t num[NCURVE_MAX+1], den[NCURVE_MAX+1], inv[NCURVE_MAX], e;
-    double p = 0.0, r, last_chkpnt_p;
-    int ret = ECM_NO_FACTOR_FOUND;
-    long last_chkpnt_time;
-    int i;
-    
-    mpz_init(e);
-    for(i = 0; i < nE; i++){
-	mpres_init(tQ[i]->x, n); mpres_set(tQ[i]->x, tP[i]->x, n);
-	mpres_init(tQ[i]->y, n); mpres_set(tQ[i]->y, tP[i]->y, n);
-	mpres_init(tQ[i]->z, n); mpres_set(tQ[i]->z, tP[i]->z, n);
-	
-	mpres_init(tR[i]->x, n);
-	mpres_init(tR[i]->y, n);
-	mpres_init(tR[i]->z, n);
-	
-	mpres_init(num[i], n);
-	mpres_init(den[i], n);
-	mpres_init(inv[i], n);
-    }
-    mpres_init(num[nE], n); /* to be used as buffer in compute_all_inverses */
-    mpres_init(den[nE], n); /* to be used as buffer in compute_all_inverses */
-    
-    last_chkpnt_time = cputime ();
-    
-#if DEBUG_MANY_EC >= 2
-    printf("Initial points:\n");
-    pt_many_print(tP, nE, n);
-#endif
-    for (r = 2.0; r <= B1; r *= 2.0)
-	if (r > *B1done){
-	    if(pt_many_duplicate (tQ, tQ, tE, nE, n, num, den, inv, ok) == 0){
-		mpz_set(f, num[nE]);
-		ret = ECM_FACTOR_FOUND_STEP1;
-		goto end_of_all;
-	    }
-#if DEBUG_MANY_EC >= 2
-	    printf("P%ld:=", (long)r); pt_many_print(tQ, nE, n); printf(";\n");
-#endif
-	}
-
-    last_chkpnt_p = 3.;
-    for (p = getprime (); p <= B1; p = getprime ()){
-	for (r = p; r <= B1; r *= p){
-#if DEBUG_MANY_EC >= 2
-	    printf("## p = %ld at %ldms\n", (long)p, cputime());
-#endif
-	    if (r > *B1done){
-		mpz_set_ui(e, (ecm_uint) p);
-		if(pt_many_mul(tR, tQ, tE, nE, e, n, num, den, inv, ok) == 0){
-		    mpz_set(f, num[nE]);
-		    ret = ECM_FACTOR_FOUND_STEP1;
-		    goto end_of_all;
-		}
-#if DEBUG_MANY_EC >= 2
-		pt_many_print(tR, nE, n);
-#endif
-		for(i = 0; i < nE; i++)
-		    if(pt_is_zero(tR[i], n))
-			ok[i] = 0;
-		pt_many_assign(tQ, tR, nE, n); /* TODO: use pointers */
-	    }
-	    if (stop_asap != NULL && (*stop_asap) ()){
-		outputf (OUTPUT_NORMAL, "Interrupted at prime %.0f\n", p);
-		break;
-	    }
-	    
-	    /* WARNING: not activated yet */
-	    if (chkfilename != NULL && p > last_chkpnt_p + 10000. && 
-		elltime (last_chkpnt_time, cputime ()) > CHKPNT_PERIOD){
-#if 0 /* TODO: make this work for many curves */
-		writechkfile (chkfilename, ECM_ECM, MAX(p, *B1done), n, A, x, y, z);
-#endif
-		last_chkpnt_p = p;
-		last_chkpnt_time = cputime ();
-	    }
-	}
-    }
- end_of_all:
-    /* If stage 1 finished normally, p is the smallest prime > B1 here.
-       In that case, set to B1 */
-    if (p > B1)
-	p = B1;
-    
-    if (p > *B1done)
-	*B1done = p;
-    
-#if 0
-    if (chkfilename != NULL)
-	writechkfile (chkfilename, ECM_ECM, *B1done, n, A, x, y, z);
-#endif
-    getprime_clear (); /* free the prime tables, and reinitialize */
-    
-    /* put results back */
-    pt_many_assign(tP, tQ, nE, n);
-    /* normalize all points */
-    for(i = 0; i < nE; i++)
-	if(pt_is_zero(tP[i], n))
-	    pt_set_to_zero(tP[i], n);
-    /* clear temporary variables */
-    mpz_clear(e);
-    for(i = 0; i < nE; i++){
-	mpres_clear(tQ[i]->x, n);
-	mpres_clear(tQ[i]->y, n);
-	mpres_clear(tQ[i]->z, n);
-	mpres_clear(num[i], n);
-	mpres_clear(den[i], n);
-	mpres_clear(inv[i], n);
-    }
-    mpres_clear(num[nE], n);
-    mpres_clear(den[nE], n);
-    return ret;
-}
-
-int
-read_and_prepare(mpz_t f, mpz_t x, mpq_t q, char *buf, mpz_t n)
-{
-    mpq_set_str(q, buf, 10);
-    if(mod_from_rat(x, q, n) == 0){
-	mpz_set(f, x);
-	return 0;
-    }
-    return 1;
-}
-
-/* 
-   OUTPUT: ECM_NO_FACTOR_FOUND
-           ECM_INPUT_NUMBER_FOUND
-           ECM_PRIME_FAC_PRIME_COFAC
-	   ECM_PRIME_FAC_COMP_COFAC
-	   ECM_COMP_FAC_COMP_COFAC
-	   ECM_COMP_FAC_PRIME_COFAC
-*/
-int
-process_many_curves(mpz_t f, mpmod_t n, double B1, mpz_t B2,
-		    ell_curve_t *tE, ell_point_t *tP, int nE, 
-		    ecm_params params, int onebyone, char *savefilename)
-{
-    double B1done;
-    ell_point_t tQ[NCURVE_MAX];
-    char *ok = (char *)malloc(nE * sizeof(char));
-    int ret = 0, i;
-    long st = cputime ();
-    
-    memset(ok, 1, nE);
-    if(onebyone != 0){
-	ret = one_curve_at_a_time(f, ok, tE, tP, nE, n->orig_modulus, params,
-				  B1, B2, savefilename);
-	free(ok);
-	return ret;
-    }
-    /* take everybody */
-    for(i = 0; i < nE; i++){
-	ell_point_init(tQ[i], tE[i], n);
-	ell_point_set(tQ[i], tP[i], tE[i], n);
-    }
-    B1done = 1.0;
-    ret = all_curves_at_once(f, ok, tE, tQ, nE, n, B1, &B1done, NULL, NULL);
-    printf("# Step 1 took %ldms\n", elltime (st, cputime ()));
-
-    if(ret != ECM_NO_FACTOR_FOUND){
-	ret = conclude_on_factor(n->orig_modulus, f, params->verbose);
-#if DEBUG_MANY_EC >= 2
-	if(ret == ECM_PRIME_FAC_PRIME_COFAC || ret == ECM_PRIME_FAC_COMP_COFAC)
-	    /* output Magma lines to check properties of E mod f */
-	    dump_curves(tE, tP, nE, f);
-#endif
-    }
-    else{
-	params->sigma_is_A = -1;
-	params->B1done = B1;
-	for(i = 0; i < nE; i++){
-	    if(ok[i] == 0)
-		continue;
-#if DEBUG_MANY_EC >= 1
-	    printf("# Entering Step 2 for E[%d]\n", i);
-#endif
-	    mpres_get_z(tP[i]->x, tQ[i]->x, n);
-	    mpres_get_z(tP[i]->y, tQ[i]->y, n);
-	    mpres_get_z(tP[i]->z, tQ[i]->z, n);
-	    ret = process_one_curve(f, n->orig_modulus, B1, B2, params,
-				    tE[i], tP[i]);
-	    if(ret != ECM_NO_FACTOR_FOUND){
-		printf("## factor found in Step 2: ");
-		mpz_out_str (stdout, 10, f);
-		printf ("\n");
-		ret = conclude_on_factor(n->orig_modulus, f, params->verbose);
-		break;
-	    }
-	}
-    }
-    for(i = 0; i < nE; i++)
-	ell_point_clear(tQ[i], tE[i], n);
-    free(ok);
-    return ret;
-}
-
-int
-read_curves_from_file(int *nE, ell_curve_t *tE, ell_point_t *tP, 
-		      mpz_t *tf, int *nf,
-		      mpmod_t n, char *fic_EP, int ncurves)
-{
-    FILE *ifile = fopen(fic_EP, "r");
-    char bufA[1024], bufx[1024], bufy[1024], c, Etype;
-    mpq_t q;
-    int ret = ECM_NO_FACTOR_FOUND;
-
-    *nE = 0;
-    mpq_init(q);
-    while(fscanf(ifile, "%s", bufA) != EOF){
-	if(bufA[0] == '#'){
-	    /* skip line and print it */
-	    printf("%s", bufA);
-	    while((c = getc(ifile)) != '\n')
-		printf("%c", c);
-	    printf("\n");
-	    continue;
-	}
-	else
-	    Etype = bufA[0];
-	ell_curve_init(tE[*nE],ECM_EC_TYPE_WEIERSTRASS,ECM_LAW_HOMOGENEOUS,n);
-	if(Etype == 'W'){
-	    if(fscanf(ifile, "%s %s %s", bufA, bufx, bufy) == EOF)
-		break;
-	    tE[*nE]->type = ECM_EC_TYPE_WEIERSTRASS;
-	    tE[*nE]->law = ECM_LAW_AFFINE;
-	}
-	else if(Etype == 'H'){
-	    if(fscanf(ifile, "%s %s %s", bufA, bufx, bufy) == EOF)
-		break;
-	    tE[*nE]->type = ECM_EC_TYPE_HESSIAN;
-	}
-	else if(Etype == 'M'){
-	    if(fscanf(ifile, "%s %s", bufA, bufx) == EOF)
-		break;
-	    tE[*nE]->type = ECM_EC_TYPE_MONTGOMERY;
-	}
-	else{
-	    printf("Unknown curve type: %c\n", Etype);
-	    return ECM_ERROR;
-	}
-	mpz_init(tE[*nE]->A);
-	if(read_and_prepare(tf[*nf], tE[*nE]->A, q, bufA, n->orig_modulus) == 0){
-	    ret = 0;
-	    *nf += 1;
-	    goto process_end;
-	}
-	ell_point_init(tP[*nE], tE[*nE], n);
-	mpz_init(tP[*nE]->x);
-	if(read_and_prepare(tf[*nf], tP[*nE]->x, q, bufx, n->orig_modulus) == 0){
-	    ret = 0;
-            *nf+= 1;
-	    goto process_end;
-	}
-	mpz_init(tP[*nE]->y);
-	if((Etype == 'W') || (Etype == 'H')){
-	    if(read_and_prepare(tf[*nf], tP[*nE]->y, q, bufy, n->orig_modulus) == 0){
-		ret = 0;
-		*nf+= 1;
-		goto process_end;
-	    }
-	}
-	mpz_init_set_ui(tP[*nE]->z, 1);
-	*nE += 1;
-	if(ncurves != 0 && *nE == ncurves)
-	    break;
-    }
- process_end:
-    fclose(ifile);
-    mpq_clear(q);
-    return ret;
-}
-
-/* Assuming we can generate curves with given torsion using parameter s
-   in interval [smin..smax].
-*/
-int
-build_curves_with_torsion(mpz_t f, mpmod_t n, ell_curve_t *tE, ell_point_t *tP,
-			  char *torsion, int smin, int smax, int nE)
-{
-    int ret = 0;
-
-    /* over Q: see Atkin-Morain, Math. Comp., 1993 */
-    if(strcmp(torsion, "Z5") == 0)
-	return build_curves_with_torsion_Z5(f, n, tE, tP, smin, smax, nE);
-    else if(strcmp(torsion, "Z7") == 0)
-	return build_curves_with_torsion_Z7(f, n, tE, tP, smin, smax, nE);
-    else if(strcmp(torsion, "Z9") == 0)
-	return build_curves_with_torsion_Z9(f, n, tE, tP, smin, smax, nE);
-    else if(strcmp(torsion, "Z10") == 0)
-	return build_curves_with_torsion_Z10(f, n, tE, tP, smin, smax, nE);
-    else if(strcmp(torsion, "Z2xZ8") == 0)
-	return build_curves_with_torsion_Z2xZ8(f, n, tE, tP, smin, smax, nE);
-    /* no longer over Q */
-    /** interesting when p = 1 mod 3 **/
-    else if(strcmp(torsion, "Z3xZ3_DuNa") == 0) /* over Q(sqrt(-3)) */
-	return build_curves_with_torsion_Z3xZ3_DuNa(n, tE, tP, smin, smax, nE);
-    else if(strcmp(torsion, "Z3xZ3") == 0) /* over Q(sqrt(-3)) */
-	return build_curves_with_torsion_Z3xZ3(f, n, tE, tP, smin, smax, nE);
-    else if(strcmp(torsion, "Z3xZ6") == 0) /* over Q(sqrt(-3)) */
-	return build_curves_with_torsion_Z3xZ6(f, n, tE, tP, smin, smax, nE);
-    /** interesting when p = 1 mod 4 **/
-    else if(strcmp(torsion, "Z4xZ4") == 0) /* over Q(sqrt(-1)) */
-	return build_curves_with_torsion_Z4xZ4(f, n, tE, tP, smin, smax, nE);
-    /** interesting when p = 1 mod 5 **/
-    else if(strcmp(torsion, "Z5xZ5") == 0) /* over Q(zeta5) */
-	return build_curves_with_torsion_Z5xZ5(n, tE, tP, smin, smax, nE);
-    /** forcing points: is this really interesting? **/
-    else if(strcmp(torsion, "Z2xZ10") == 0)
-	return build_curves_with_torsion_Z2xZ10(f, n, tE, tP, smin, smax, nE);
-    else if(strcmp(torsion, "Z2xZ12") == 0)
-	return build_curves_with_torsion_Z2xZ12(f, n, tE, tP, smin, smax, nE);
-    else{
-	printf("Unknown torsion group: %s\n", torsion);
-	ret = ECM_ERROR;
-    }
-    return ret;
-}
-
-/* 
-   OUTPUT: ECM_NO_FACTOR_FOUND
-           ECM_PRIME_FAC_PRIME_COFAC
-	   ECM_PRIME_FAC_COMP_COFAC
-	   ECM_COMP_FAC_COMP_COFAC
-	   ECM_COMP_FAC_PRIME_COFAC
-  One ring to run them all.
-*/
-int
-process_many_curves_loop(mpz_t tf[], int *nf, mpz_t n, double B1, mpz_t B2,
-			 ecm_params params,
-			 char *fic_EP,
-			 char *torsion, int smin, int smax, int nE,
-			 int disc, mpz_t *sqroots,
-			 char *savefilename)
-{
-    ell_curve_t tE[NCURVE_MAX];
-    ell_point_t tP[NCURVE_MAX];
-    mpmod_t modulus;
-    int ret = 0, i, onebyone;
-
-    onebyone = 1; /* mtyform; */
-    while(1){
-	/* cheating with the content of tE and tP that are first defined
-	   over Z/nZ without residues
-	 */
-	mpmod_init(modulus, n, ECM_MOD_DEFAULT);
-	if(fic_EP != NULL)
-	    ret = read_curves_from_file(&nE, tE, tP, tf, nf, modulus, 
-					fic_EP, nE);
-	else if(torsion != NULL)
-	    ret = build_curves_with_torsion(tf[*nf],modulus,tE,tP,
-					    torsion,smin,smax,nE);
-	else if(disc != 0)



More information about the Ecm-commits mailing list